winejoystick: Fix a crash on accessing a CFArray past its end due to an off-by-one...
[wine/multimedia.git] / dlls / kernel32 / virtual.c
blob03ef38cc1c684f0492753d114483e7a62d56f75f
1 /*
2 * Win32 virtual memory functions
4 * Copyright 1997 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <fcntl.h>
25 #include <stdarg.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <sys/types.h>
29 #ifdef HAVE_UNISTD_H
30 # include <unistd.h>
31 #endif
33 #include "ntstatus.h"
34 #define WIN32_NO_STATUS
35 #define NONAMELESSUNION
36 #include "windef.h"
37 #include "winbase.h"
38 #include "winnls.h"
39 #include "winternl.h"
40 #include "winerror.h"
41 #include "psapi.h"
42 #include "wine/exception.h"
43 #include "wine/debug.h"
45 #include "kernel_private.h"
47 WINE_DECLARE_DEBUG_CHANNEL(seh);
48 WINE_DECLARE_DEBUG_CHANNEL(file);
51 /***********************************************************************
52 * VirtualAlloc (KERNEL32.@)
54 * Reserves or commits a region of pages in virtual address space.
56 * PARAMS
57 * addr [I] Address of region to reserve or commit.
58 * size [I] Size of region.
59 * type [I] Type of allocation.
60 * protect [I] Type of access protection.
62 * RETURNS
63 * Success: Base address of allocated region of pages.
64 * Failure: NULL.
66 LPVOID WINAPI VirtualAlloc( LPVOID addr, SIZE_T size, DWORD type, DWORD protect )
68 return VirtualAllocEx( GetCurrentProcess(), addr, size, type, protect );
72 /***********************************************************************
73 * VirtualAllocEx (KERNEL32.@)
75 * Seems to be just as VirtualAlloc, but with process handle.
77 * PARAMS
78 * hProcess [I] Handle to process to do mem operation.
79 * addr [I] Address of region to reserve or commit.
80 * size [I] Size of region.
81 * type [I] Type of allocation.
82 * protect [I] Type of access protection.
85 * RETURNS
86 * Success: Base address of allocated region of pages.
87 * Failure: NULL.
89 LPVOID WINAPI VirtualAllocEx( HANDLE hProcess, LPVOID addr, SIZE_T size,
90 DWORD type, DWORD protect )
92 LPVOID ret = addr;
93 NTSTATUS status;
95 if ((status = NtAllocateVirtualMemory( hProcess, &ret, 0, &size, type, protect )))
97 SetLastError( RtlNtStatusToDosError(status) );
98 ret = NULL;
100 return ret;
104 /***********************************************************************
105 * VirtualFree (KERNEL32.@)
107 * Releases or decommits a region of pages in virtual address space.
109 * PARAMS
110 * addr [I] Address of region of committed pages.
111 * size [I] Size of region.
112 * type [I] Type of operation.
114 * RETURNS
115 * Success: TRUE.
116 * Failure: FALSE.
118 BOOL WINAPI VirtualFree( LPVOID addr, SIZE_T size, DWORD type )
120 return VirtualFreeEx( GetCurrentProcess(), addr, size, type );
124 /***********************************************************************
125 * VirtualFreeEx (KERNEL32.@)
127 * Releases or decommits a region of pages in virtual address space.
129 * PARAMS
130 * process [I] Handle to process.
131 * addr [I] Address of region to free.
132 * size [I] Size of region.
133 * type [I] Type of operation.
135 * RETURNS
136 * Success: TRUE.
137 * Failure: FALSE.
139 BOOL WINAPI VirtualFreeEx( HANDLE process, LPVOID addr, SIZE_T size, DWORD type )
141 NTSTATUS status = NtFreeVirtualMemory( process, &addr, &size, type );
142 if (status) SetLastError( RtlNtStatusToDosError(status) );
143 return !status;
147 /***********************************************************************
148 * VirtualLock (KERNEL32.@)
150 * Locks the specified region of virtual address space.
152 * PARAMS
153 * addr [I] Address of first byte of range to lock.
154 * size [I] Number of bytes in range to lock.
156 * RETURNS
157 * Success: TRUE.
158 * Failure: FALSE.
160 * NOTES
161 * Always returns TRUE.
164 BOOL WINAPI VirtualLock( LPVOID addr, SIZE_T size )
166 NTSTATUS status = NtLockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
167 if (status) SetLastError( RtlNtStatusToDosError(status) );
168 return !status;
172 /***********************************************************************
173 * VirtualUnlock (KERNEL32.@)
175 * Unlocks a range of pages in the virtual address space.
177 * PARAMS
178 * addr [I] Address of first byte of range.
179 * size [I] Number of bytes in range.
181 * RETURNS
182 * Success: TRUE.
183 * Failure: FALSE.
185 * NOTES
186 * Always returns TRUE.
189 BOOL WINAPI VirtualUnlock( LPVOID addr, SIZE_T size )
191 NTSTATUS status = NtUnlockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
192 if (status) SetLastError( RtlNtStatusToDosError(status) );
193 return !status;
197 /***********************************************************************
198 * VirtualProtect (KERNEL32.@)
200 * Changes the access protection on a region of committed pages.
202 * PARAMS
203 * addr [I] Address of region of committed pages.
204 * size [I] Size of region.
205 * new_prot [I] Desired access protection.
206 * old_prot [O] Address of variable to get old protection.
208 * RETURNS
209 * Success: TRUE.
210 * Failure: FALSE.
212 BOOL WINAPI VirtualProtect( LPVOID addr, SIZE_T size, DWORD new_prot, LPDWORD old_prot)
214 return VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
218 /***********************************************************************
219 * VirtualProtectEx (KERNEL32.@)
221 * Changes the access protection on a region of committed pages in the
222 * virtual address space of a specified process.
224 * PARAMS
225 * process [I] Handle of process.
226 * addr [I] Address of region of committed pages.
227 * size [I] Size of region.
228 * new_prot [I] Desired access protection.
229 * old_prot [O] Address of variable to get old protection.
231 * RETURNS
232 * Success: TRUE.
233 * Failure: FALSE.
235 BOOL WINAPI VirtualProtectEx( HANDLE process, LPVOID addr, SIZE_T size,
236 DWORD new_prot, LPDWORD old_prot )
238 NTSTATUS status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot );
239 if (status) SetLastError( RtlNtStatusToDosError(status) );
240 return !status;
244 /***********************************************************************
245 * VirtualQuery (KERNEL32.@)
247 * Provides info about a range of pages in virtual address space.
249 * PARAMS
250 * addr [I] Address of region.
251 * info [O] Address of info buffer.
252 * len [I] Size of buffer.
254 * RETURNS
255 * Number of bytes returned in information buffer or 0 if
256 * addr >= 0xc0000000 (kernel space).
258 SIZE_T WINAPI VirtualQuery( LPCVOID addr, PMEMORY_BASIC_INFORMATION info,
259 SIZE_T len )
261 return VirtualQueryEx( GetCurrentProcess(), addr, info, len );
265 /***********************************************************************
266 * VirtualQueryEx (KERNEL32.@)
268 * Provides info about a range of pages in virtual address space of a
269 * specified process.
271 * PARAMS
272 * process [I] Handle to process.
273 * addr [I] Address of region.
274 * info [O] Address of info buffer.
275 * len [I] Size of buffer.
277 * RETURNS
278 * Number of bytes returned in information buffer.
280 SIZE_T WINAPI VirtualQueryEx( HANDLE process, LPCVOID addr,
281 PMEMORY_BASIC_INFORMATION info, SIZE_T len )
283 SIZE_T ret;
284 NTSTATUS status;
286 if ((status = NtQueryVirtualMemory( process, addr, MemoryBasicInformation, info, len, &ret )))
288 SetLastError( RtlNtStatusToDosError(status) );
289 ret = 0;
291 return ret;
295 /***********************************************************************
296 * CreateFileMappingA (KERNEL32.@)
298 * Creates a named or unnamed file-mapping object for the specified file.
300 * PARAMS
301 * hFile [I] Handle to the file to map.
302 * sa [I] Optional security attributes.
303 * protect [I] Protection for mapping object.
304 * size_high [I] High-order 32 bits of object size.
305 * size_low [I] Low-order 32 bits of object size.
306 * name [I] Name of file-mapping object.
308 * RETURNS
309 * Success: Handle.
310 * Failure: NULL. Mapping object does not exist.
312 HANDLE WINAPI CreateFileMappingA( HANDLE hFile, SECURITY_ATTRIBUTES *sa,
313 DWORD protect, DWORD size_high, DWORD size_low, LPCSTR name )
315 WCHAR buffer[MAX_PATH];
317 if (!name) return CreateFileMappingW( hFile, sa, protect, size_high, size_low, NULL );
319 if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
321 SetLastError( ERROR_FILENAME_EXCED_RANGE );
322 return 0;
324 return CreateFileMappingW( hFile, sa, protect, size_high, size_low, buffer );
328 /***********************************************************************
329 * CreateFileMappingW (KERNEL32.@)
331 * See CreateFileMappingA.
333 HANDLE WINAPI CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES sa,
334 DWORD protect, DWORD size_high,
335 DWORD size_low, LPCWSTR name )
337 static const int sec_flags = SEC_FILE | SEC_IMAGE | SEC_RESERVE | SEC_COMMIT | SEC_NOCACHE;
339 HANDLE ret;
340 NTSTATUS status;
341 DWORD access, sec_type;
342 LARGE_INTEGER size;
344 sec_type = protect & sec_flags;
345 protect &= ~sec_flags;
346 if (!sec_type) sec_type = SEC_COMMIT;
348 /* Win9x compatibility */
349 if (!protect && (GetVersion() & 0x80000000)) protect = PAGE_READONLY;
351 switch(protect)
353 case PAGE_READONLY:
354 case PAGE_WRITECOPY:
355 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ;
356 break;
357 case PAGE_READWRITE:
358 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE;
359 break;
360 case PAGE_EXECUTE_READ:
361 case PAGE_EXECUTE_WRITECOPY:
362 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_EXECUTE;
363 break;
364 case PAGE_EXECUTE_READWRITE:
365 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE;
366 break;
367 default:
368 SetLastError( ERROR_INVALID_PARAMETER );
369 return 0;
372 if (hFile == INVALID_HANDLE_VALUE)
374 hFile = 0;
375 if (!size_low && !size_high)
377 SetLastError( ERROR_INVALID_PARAMETER );
378 return 0;
382 size.u.LowPart = size_low;
383 size.u.HighPart = size_high;
385 if (sa || name)
387 OBJECT_ATTRIBUTES attr;
388 UNICODE_STRING nameW;
390 attr.Length = sizeof(attr);
391 attr.RootDirectory = 0;
392 attr.ObjectName = NULL;
393 attr.Attributes = OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0);
394 attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
395 attr.SecurityQualityOfService = NULL;
396 if (name)
398 RtlInitUnicodeString( &nameW, name );
399 attr.ObjectName = &nameW;
400 attr.RootDirectory = get_BaseNamedObjects_handle();
402 status = NtCreateSection( &ret, access, &attr, &size, protect, sec_type, hFile );
404 else status = NtCreateSection( &ret, access, NULL, &size, protect, sec_type, hFile );
406 if (status == STATUS_OBJECT_NAME_EXISTS)
407 SetLastError( ERROR_ALREADY_EXISTS );
408 else
409 SetLastError( RtlNtStatusToDosError(status) );
410 return ret;
414 /***********************************************************************
415 * OpenFileMappingA (KERNEL32.@)
417 * Opens a named file-mapping object.
419 * PARAMS
420 * access [I] Access mode.
421 * inherit [I] Inherit flag.
422 * name [I] Name of file-mapping object.
424 * RETURNS
425 * Success: Handle.
426 * Failure: NULL.
428 HANDLE WINAPI OpenFileMappingA( DWORD access, BOOL inherit, LPCSTR name )
430 WCHAR buffer[MAX_PATH];
432 if (!name) return OpenFileMappingW( access, inherit, NULL );
434 if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
436 SetLastError( ERROR_FILENAME_EXCED_RANGE );
437 return 0;
439 return OpenFileMappingW( access, inherit, buffer );
443 /***********************************************************************
444 * OpenFileMappingW (KERNEL32.@)
446 * See OpenFileMappingA.
448 HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
450 OBJECT_ATTRIBUTES attr;
451 UNICODE_STRING nameW;
452 HANDLE ret;
453 NTSTATUS status;
455 if (!name)
457 SetLastError( ERROR_INVALID_PARAMETER );
458 return 0;
460 attr.Length = sizeof(attr);
461 attr.RootDirectory = get_BaseNamedObjects_handle();
462 attr.ObjectName = &nameW;
463 attr.Attributes = inherit ? OBJ_INHERIT : 0;
464 attr.SecurityDescriptor = NULL;
465 attr.SecurityQualityOfService = NULL;
466 RtlInitUnicodeString( &nameW, name );
468 if (access == FILE_MAP_COPY) access = SECTION_MAP_READ;
469 access |= SECTION_QUERY;
471 if (GetVersion() & 0x80000000)
473 /* win9x doesn't do access checks, so try with full access first */
474 if (!NtOpenSection( &ret, access | SECTION_MAP_READ | SECTION_MAP_WRITE, &attr )) return ret;
477 if ((status = NtOpenSection( &ret, access, &attr )))
479 SetLastError( RtlNtStatusToDosError(status) );
480 ret = 0;
482 return ret;
486 /***********************************************************************
487 * MapViewOfFile (KERNEL32.@)
489 * Maps a view of a file into the address space.
491 * PARAMS
492 * mapping [I] File-mapping object to map.
493 * access [I] Access mode.
494 * offset_high [I] High-order 32 bits of file offset.
495 * offset_low [I] Low-order 32 bits of file offset.
496 * count [I] Number of bytes to map.
498 * RETURNS
499 * Success: Starting address of mapped view.
500 * Failure: NULL.
502 LPVOID WINAPI MapViewOfFile( HANDLE mapping, DWORD access,
503 DWORD offset_high, DWORD offset_low, SIZE_T count )
505 return MapViewOfFileEx( mapping, access, offset_high,
506 offset_low, count, NULL );
510 /***********************************************************************
511 * MapViewOfFileEx (KERNEL32.@)
513 * Maps a view of a file into the address space.
515 * PARAMS
516 * handle [I] File-mapping object to map.
517 * access [I] Access mode.
518 * offset_high [I] High-order 32 bits of file offset.
519 * offset_low [I] Low-order 32 bits of file offset.
520 * count [I] Number of bytes to map.
521 * addr [I] Suggested starting address for mapped view.
523 * RETURNS
524 * Success: Starting address of mapped view.
525 * Failure: NULL.
527 LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access,
528 DWORD offset_high, DWORD offset_low, SIZE_T count, LPVOID addr )
530 NTSTATUS status;
531 LARGE_INTEGER offset;
532 ULONG protect;
533 BOOL exec;
535 offset.u.LowPart = offset_low;
536 offset.u.HighPart = offset_high;
538 exec = access & FILE_MAP_EXECUTE;
539 access &= ~FILE_MAP_EXECUTE;
541 if (access == FILE_MAP_COPY)
542 protect = exec ? PAGE_EXECUTE_WRITECOPY : PAGE_WRITECOPY;
543 else if (access & FILE_MAP_WRITE)
544 protect = exec ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
545 else if (access & FILE_MAP_READ)
546 protect = exec ? PAGE_EXECUTE_READ : PAGE_READONLY;
547 else protect = PAGE_NOACCESS;
549 if ((status = NtMapViewOfSection( handle, GetCurrentProcess(), &addr, 0, 0, &offset,
550 &count, ViewShare, 0, protect )) < 0)
552 SetLastError( RtlNtStatusToDosError(status) );
553 addr = NULL;
555 return addr;
559 /***********************************************************************
560 * UnmapViewOfFile (KERNEL32.@)
562 * Unmaps a mapped view of a file.
564 * PARAMS
565 * addr [I] Address where mapped view begins.
567 * RETURNS
568 * Success: TRUE.
569 * Failure: FALSE.
572 BOOL WINAPI UnmapViewOfFile( LPCVOID addr )
574 NTSTATUS status = NtUnmapViewOfSection( GetCurrentProcess(), (void *)addr );
575 if (status) SetLastError( RtlNtStatusToDosError(status) );
576 return !status;
580 /***********************************************************************
581 * FlushViewOfFile (KERNEL32.@)
583 * Writes to the disk a byte range within a mapped view of a file.
585 * PARAMS
586 * base [I] Start address of byte range to flush.
587 * size [I] Number of bytes in range.
589 * RETURNS
590 * Success: TRUE.
591 * Failure: FALSE.
593 BOOL WINAPI FlushViewOfFile( LPCVOID base, SIZE_T size )
595 NTSTATUS status = NtFlushVirtualMemory( GetCurrentProcess(), &base, &size, 0 );
596 if (status)
598 if (status == STATUS_NOT_MAPPED_DATA) status = STATUS_SUCCESS;
599 else SetLastError( RtlNtStatusToDosError(status) );
601 return !status;
605 /***********************************************************************
606 * GetWriteWatch (KERNEL32.@)
608 UINT WINAPI GetWriteWatch( DWORD flags, LPVOID base, SIZE_T size, LPVOID *addresses,
609 ULONG_PTR *count, ULONG *granularity )
611 NTSTATUS status;
613 status = NtGetWriteWatch( GetCurrentProcess(), flags, base, size, addresses, count, granularity );
614 if (status) SetLastError( RtlNtStatusToDosError(status) );
615 return status ? ~0u : 0;
619 /***********************************************************************
620 * ResetWriteWatch (KERNEL32.@)
622 UINT WINAPI ResetWriteWatch( LPVOID base, SIZE_T size )
624 NTSTATUS status;
626 status = NtResetWriteWatch( GetCurrentProcess(), base, size );
627 if (status) SetLastError( RtlNtStatusToDosError(status) );
628 return status ? ~0u : 0;
632 /***********************************************************************
633 * IsBadReadPtr (KERNEL32.@)
635 * Check for read access on a memory block.
637 * ptr [I] Address of memory block.
638 * size [I] Size of block.
640 * RETURNS
641 * Success: TRUE.
642 * Failure: FALSE. Process has read access to entire block.
644 BOOL WINAPI IsBadReadPtr( LPCVOID ptr, UINT size )
646 if (!size) return FALSE; /* handle 0 size case w/o reference */
647 if (!ptr) return TRUE;
648 __TRY
650 volatile const char *p = ptr;
651 char dummy __attribute__((unused));
652 UINT count = size;
654 while (count > system_info.PageSize)
656 dummy = *p;
657 p += system_info.PageSize;
658 count -= system_info.PageSize;
660 dummy = p[0];
661 dummy = p[count - 1];
663 __EXCEPT_PAGE_FAULT
665 TRACE_(seh)("%p caused page fault during read\n", ptr);
666 return TRUE;
668 __ENDTRY
669 return FALSE;
673 /***********************************************************************
674 * IsBadWritePtr (KERNEL32.@)
676 * Check for write access on a memory block.
678 * PARAMS
679 * ptr [I] Address of memory block.
680 * size [I] Size of block in bytes.
682 * RETURNS
683 * Success: TRUE.
684 * Failure: FALSE. Process has write access to entire block.
686 BOOL WINAPI IsBadWritePtr( LPVOID ptr, UINT size )
688 if (!size) return FALSE; /* handle 0 size case w/o reference */
689 if (!ptr) return TRUE;
690 __TRY
692 volatile char *p = ptr;
693 UINT count = size;
695 while (count > system_info.PageSize)
697 *p |= 0;
698 p += system_info.PageSize;
699 count -= system_info.PageSize;
701 p[0] |= 0;
702 p[count - 1] |= 0;
704 __EXCEPT_PAGE_FAULT
706 TRACE_(seh)("%p caused page fault during write\n", ptr);
707 return TRUE;
709 __ENDTRY
710 return FALSE;
714 /***********************************************************************
715 * IsBadHugeReadPtr (KERNEL32.@)
717 * Check for read access on a memory block.
719 * PARAMS
720 * ptr [I] Address of memory block.
721 * size [I] Size of block.
723 * RETURNS
724 * Success: TRUE.
725 * Failure: FALSE. Process has read access to entire block.
727 BOOL WINAPI IsBadHugeReadPtr( LPCVOID ptr, UINT size )
729 return IsBadReadPtr( ptr, size );
733 /***********************************************************************
734 * IsBadHugeWritePtr (KERNEL32.@)
736 * Check for write access on a memory block.
738 * PARAMS
739 * ptr [I] Address of memory block.
740 * size [I] Size of block.
742 * RETURNS
743 * Success: TRUE.
744 * Failure: FALSE. Process has write access to entire block.
746 BOOL WINAPI IsBadHugeWritePtr( LPVOID ptr, UINT size )
748 return IsBadWritePtr( ptr, size );
752 /***********************************************************************
753 * IsBadCodePtr (KERNEL32.@)
755 * Check for read access on a memory address.
757 * PARAMS
758 * ptr [I] Address of function.
760 * RETURNS
761 * Success: TRUE.
762 * Failure: FALSE. Process has read access to specified memory.
764 BOOL WINAPI IsBadCodePtr( FARPROC ptr )
766 return IsBadReadPtr( ptr, 1 );
770 /***********************************************************************
771 * IsBadStringPtrA (KERNEL32.@)
773 * Check for read access on a range of memory pointed to by a string pointer.
775 * PARAMS
776 * str [I] Address of string.
777 * max [I] Maximum size of string.
779 * RETURNS
780 * Success: TRUE.
781 * Failure: FALSE. Read access to all bytes in string.
783 BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT max )
785 if (!str) return TRUE;
787 __TRY
789 volatile const char *p = str;
790 while (p != str + max) if (!*p++) break;
792 __EXCEPT_PAGE_FAULT
794 TRACE_(seh)("%p caused page fault during read\n", str);
795 return TRUE;
797 __ENDTRY
798 return FALSE;
802 /***********************************************************************
803 * IsBadStringPtrW (KERNEL32.@)
805 * See IsBadStringPtrA.
807 BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max )
809 if (!str) return TRUE;
811 __TRY
813 volatile const WCHAR *p = str;
814 while (p != str + max) if (!*p++) break;
816 __EXCEPT_PAGE_FAULT
818 TRACE_(seh)("%p caused page fault during read\n", str);
819 return TRUE;
821 __ENDTRY
822 return FALSE;
825 /***********************************************************************
826 * K32GetMappedFileNameA (KERNEL32.@)
828 DWORD WINAPI K32GetMappedFileNameA(HANDLE process, LPVOID lpv, LPSTR file_name, DWORD size)
830 FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
832 if (file_name && size)
833 file_name[0] = '\0';
835 return 0;
838 /***********************************************************************
839 * K32GetMappedFileNameW (KERNEL32.@)
841 DWORD WINAPI K32GetMappedFileNameW(HANDLE process, LPVOID lpv, LPWSTR file_name, DWORD size)
843 FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
845 if (file_name && size)
846 file_name[0] = '\0';
848 return 0;
851 /***********************************************************************
852 * K32EnumPageFilesA (KERNEL32.@)
854 BOOL WINAPI K32EnumPageFilesA( PENUM_PAGE_FILE_CALLBACKA callback, LPVOID context )
856 FIXME_(file)("(%p, %p) stub\n", callback, context );
857 return FALSE;
860 /***********************************************************************
861 * K32EnumPageFilesW (KERNEL32.@)
863 BOOL WINAPI K32EnumPageFilesW( PENUM_PAGE_FILE_CALLBACKW callback, LPVOID context )
865 FIXME_(file)("(%p, %p) stub\n", callback, context );
866 return FALSE;
869 /***********************************************************************
870 * K32GetWsChanges (KERNEL32.@)
872 BOOL WINAPI K32GetWsChanges(HANDLE process, PPSAPI_WS_WATCH_INFORMATION watchinfo, DWORD size)
874 NTSTATUS status;
876 TRACE_(seh)("(%p, %p, %d)\n", process, watchinfo, size);
878 status = NtQueryInformationProcess( process, ProcessWorkingSetWatch, watchinfo, size, NULL );
880 if (status)
882 SetLastError( RtlNtStatusToDosError( status ) );
883 return FALSE;
885 return TRUE;
888 /***********************************************************************
889 * K32InitializeProcessForWsWatch (KERNEL32.@)
891 BOOL WINAPI K32InitializeProcessForWsWatch(HANDLE process)
893 FIXME_(seh)("(process=%p): stub\n", process);
895 return TRUE;