setupapi: Add pSetupFree|Malloc|Realloc to spec file and forward them.
[wine.git] / dlls / kernel32 / virtual.c
blob632839930270f368a808b91f28e68b2befd593d4
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 #define NONAMELESSUNION
34 #define NONAMELESSSTRUCT
35 #include "ntstatus.h"
36 #define WIN32_NO_STATUS
37 #include "windef.h"
38 #include "winbase.h"
39 #include "winnls.h"
40 #include "winternl.h"
41 #include "winerror.h"
42 #include "psapi.h"
43 #include "wine/exception.h"
44 #include "wine/debug.h"
46 #include "kernel_private.h"
48 WINE_DECLARE_DEBUG_CHANNEL(seh);
49 WINE_DECLARE_DEBUG_CHANNEL(file);
51 static unsigned int page_size;
54 /***********************************************************************
55 * VirtualAlloc (KERNEL32.@)
57 * Reserves or commits a region of pages in virtual address space.
59 * PARAMS
60 * addr [I] Address of region to reserve or commit.
61 * size [I] Size of region.
62 * type [I] Type of allocation.
63 * protect [I] Type of access protection.
65 * RETURNS
66 * Success: Base address of allocated region of pages.
67 * Failure: NULL.
69 LPVOID WINAPI VirtualAlloc( LPVOID addr, SIZE_T size, DWORD type, DWORD protect )
71 return VirtualAllocEx( GetCurrentProcess(), addr, size, type, protect );
75 /***********************************************************************
76 * VirtualAllocEx (KERNEL32.@)
78 * Seems to be just as VirtualAlloc, but with process handle.
80 * PARAMS
81 * hProcess [I] Handle to process to do mem operation.
82 * addr [I] Address of region to reserve or commit.
83 * size [I] Size of region.
84 * type [I] Type of allocation.
85 * protect [I] Type of access protection.
88 * RETURNS
89 * Success: Base address of allocated region of pages.
90 * Failure: NULL.
92 LPVOID WINAPI VirtualAllocEx( HANDLE hProcess, LPVOID addr, SIZE_T size,
93 DWORD type, DWORD protect )
95 LPVOID ret = addr;
96 NTSTATUS status;
98 if ((status = NtAllocateVirtualMemory( hProcess, &ret, 0, &size, type, protect )))
100 SetLastError( RtlNtStatusToDosError(status) );
101 ret = NULL;
103 return ret;
107 /***********************************************************************
108 * VirtualFree (KERNEL32.@)
110 * Releases or decommits a region of pages in virtual address space.
112 * PARAMS
113 * addr [I] Address of region of committed pages.
114 * size [I] Size of region.
115 * type [I] Type of operation.
117 * RETURNS
118 * Success: TRUE.
119 * Failure: FALSE.
121 BOOL WINAPI VirtualFree( LPVOID addr, SIZE_T size, DWORD type )
123 return VirtualFreeEx( GetCurrentProcess(), addr, size, type );
127 /***********************************************************************
128 * VirtualFreeEx (KERNEL32.@)
130 * Releases or decommits a region of pages in virtual address space.
132 * PARAMS
133 * process [I] Handle to process.
134 * addr [I] Address of region to free.
135 * size [I] Size of region.
136 * type [I] Type of operation.
138 * RETURNS
139 * Success: TRUE.
140 * Failure: FALSE.
142 BOOL WINAPI VirtualFreeEx( HANDLE process, LPVOID addr, SIZE_T size, DWORD type )
144 NTSTATUS status = NtFreeVirtualMemory( process, &addr, &size, type );
145 if (status) SetLastError( RtlNtStatusToDosError(status) );
146 return !status;
150 /***********************************************************************
151 * VirtualLock (KERNEL32.@)
153 * Locks the specified region of virtual address space.
155 * PARAMS
156 * addr [I] Address of first byte of range to lock.
157 * size [I] Number of bytes in range to lock.
159 * RETURNS
160 * Success: TRUE.
161 * Failure: FALSE.
163 * NOTES
164 * Always returns TRUE.
167 BOOL WINAPI VirtualLock( LPVOID addr, SIZE_T size )
169 NTSTATUS status = NtLockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
170 if (status) SetLastError( RtlNtStatusToDosError(status) );
171 return !status;
175 /***********************************************************************
176 * VirtualUnlock (KERNEL32.@)
178 * Unlocks a range of pages in the virtual address space.
180 * PARAMS
181 * addr [I] Address of first byte of range.
182 * size [I] Number of bytes in range.
184 * RETURNS
185 * Success: TRUE.
186 * Failure: FALSE.
188 * NOTES
189 * Always returns TRUE.
192 BOOL WINAPI VirtualUnlock( LPVOID addr, SIZE_T size )
194 NTSTATUS status = NtUnlockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
195 if (status) SetLastError( RtlNtStatusToDosError(status) );
196 return !status;
200 /***********************************************************************
201 * VirtualProtect (KERNEL32.@)
203 * Changes the access protection on a region of committed pages.
205 * PARAMS
206 * addr [I] Address of region of committed pages.
207 * size [I] Size of region.
208 * new_prot [I] Desired access protection.
209 * old_prot [O] Address of variable to get old protection.
211 * RETURNS
212 * Success: TRUE.
213 * Failure: FALSE.
215 BOOL WINAPI VirtualProtect( LPVOID addr, SIZE_T size, DWORD new_prot, LPDWORD old_prot)
217 return VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
221 /***********************************************************************
222 * VirtualProtectEx (KERNEL32.@)
224 * Changes the access protection on a region of committed pages in the
225 * virtual address space of a specified process.
227 * PARAMS
228 * process [I] Handle of process.
229 * addr [I] Address of region of committed pages.
230 * size [I] Size of region.
231 * new_prot [I] Desired access protection.
232 * old_prot [O] Address of variable to get old protection.
234 * RETURNS
235 * Success: TRUE.
236 * Failure: FALSE.
238 BOOL WINAPI VirtualProtectEx( HANDLE process, LPVOID addr, SIZE_T size,
239 DWORD new_prot, LPDWORD old_prot )
241 NTSTATUS status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot );
242 if (status) SetLastError( RtlNtStatusToDosError(status) );
243 return !status;
247 /***********************************************************************
248 * VirtualQuery (KERNEL32.@)
250 * Provides info about a range of pages in virtual address space.
252 * PARAMS
253 * addr [I] Address of region.
254 * info [O] Address of info buffer.
255 * len [I] Size of buffer.
257 * RETURNS
258 * Number of bytes returned in information buffer or 0 if
259 * addr >= 0xc0000000 (kernel space).
261 SIZE_T WINAPI VirtualQuery( LPCVOID addr, PMEMORY_BASIC_INFORMATION info,
262 SIZE_T len )
264 return VirtualQueryEx( GetCurrentProcess(), addr, info, len );
268 /***********************************************************************
269 * VirtualQueryEx (KERNEL32.@)
271 * Provides info about a range of pages in virtual address space of a
272 * specified process.
274 * PARAMS
275 * process [I] Handle to process.
276 * addr [I] Address of region.
277 * info [O] Address of info buffer.
278 * len [I] Size of buffer.
280 * RETURNS
281 * Number of bytes returned in information buffer.
283 SIZE_T WINAPI VirtualQueryEx( HANDLE process, LPCVOID addr,
284 PMEMORY_BASIC_INFORMATION info, SIZE_T len )
286 SIZE_T ret;
287 NTSTATUS status;
289 if ((status = NtQueryVirtualMemory( process, addr, MemoryBasicInformation, info, len, &ret )))
291 SetLastError( RtlNtStatusToDosError(status) );
292 ret = 0;
294 return ret;
298 /***********************************************************************
299 * CreateFileMappingA (KERNEL32.@)
301 * Creates a named or unnamed file-mapping object for the specified file.
303 * PARAMS
304 * hFile [I] Handle to the file to map.
305 * sa [I] Optional security attributes.
306 * protect [I] Protection for mapping object.
307 * size_high [I] High-order 32 bits of object size.
308 * size_low [I] Low-order 32 bits of object size.
309 * name [I] Name of file-mapping object.
311 * RETURNS
312 * Success: Handle.
313 * Failure: NULL. Mapping object does not exist.
315 HANDLE WINAPI CreateFileMappingA( HANDLE hFile, SECURITY_ATTRIBUTES *sa,
316 DWORD protect, DWORD size_high, DWORD size_low, LPCSTR name )
318 WCHAR buffer[MAX_PATH];
320 if (!name) return CreateFileMappingW( hFile, sa, protect, size_high, size_low, NULL );
322 if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
324 SetLastError( ERROR_FILENAME_EXCED_RANGE );
325 return 0;
327 return CreateFileMappingW( hFile, sa, protect, size_high, size_low, buffer );
331 /***********************************************************************
332 * CreateFileMappingW (KERNEL32.@)
334 * See CreateFileMappingA.
336 HANDLE WINAPI CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES sa,
337 DWORD protect, DWORD size_high,
338 DWORD size_low, LPCWSTR name )
340 static const int sec_flags = SEC_FILE | SEC_IMAGE | SEC_RESERVE | SEC_COMMIT | SEC_NOCACHE;
342 HANDLE ret;
343 NTSTATUS status;
344 DWORD access, sec_type;
345 LARGE_INTEGER size;
347 sec_type = protect & sec_flags;
348 protect &= ~sec_flags;
349 if (!sec_type) sec_type = SEC_COMMIT;
351 switch(protect)
353 case 0:
354 protect = PAGE_READONLY; /* Win9x compatibility */
355 /* fall through */
356 case PAGE_READONLY:
357 case PAGE_WRITECOPY:
358 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_EXECUTE;
359 break;
360 case PAGE_READWRITE:
361 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE;
362 break;
363 case PAGE_EXECUTE:
364 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_EXECUTE | SECTION_MAP_EXECUTE_EXPLICIT;
365 break;
366 case PAGE_EXECUTE_READ:
367 case PAGE_EXECUTE_WRITECOPY:
368 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_MAP_EXECUTE_EXPLICIT;
369 break;
370 case PAGE_EXECUTE_READWRITE:
371 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE | SECTION_MAP_EXECUTE_EXPLICIT;
372 break;
373 default:
374 SetLastError( ERROR_INVALID_PARAMETER );
375 return 0;
378 if (hFile == INVALID_HANDLE_VALUE)
380 hFile = 0;
381 if (!size_low && !size_high)
383 SetLastError( ERROR_INVALID_PARAMETER );
384 return 0;
388 size.u.LowPart = size_low;
389 size.u.HighPart = size_high;
391 if (sa || name)
393 OBJECT_ATTRIBUTES attr;
394 UNICODE_STRING nameW;
396 attr.Length = sizeof(attr);
397 attr.RootDirectory = 0;
398 attr.ObjectName = NULL;
399 attr.Attributes = OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0);
400 attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
401 attr.SecurityQualityOfService = NULL;
402 if (name)
404 RtlInitUnicodeString( &nameW, name );
405 attr.ObjectName = &nameW;
406 attr.RootDirectory = get_BaseNamedObjects_handle();
408 status = NtCreateSection( &ret, access, &attr, &size, protect, sec_type, hFile );
410 else status = NtCreateSection( &ret, access, NULL, &size, protect, sec_type, hFile );
412 if (status == STATUS_OBJECT_NAME_EXISTS)
413 SetLastError( ERROR_ALREADY_EXISTS );
414 else
415 SetLastError( RtlNtStatusToDosError(status) );
416 return ret;
420 /***********************************************************************
421 * OpenFileMappingA (KERNEL32.@)
423 * Opens a named file-mapping object.
425 * PARAMS
426 * access [I] Access mode.
427 * inherit [I] Inherit flag.
428 * name [I] Name of file-mapping object.
430 * RETURNS
431 * Success: Handle.
432 * Failure: NULL.
434 HANDLE WINAPI OpenFileMappingA( DWORD access, BOOL inherit, LPCSTR name )
436 WCHAR buffer[MAX_PATH];
438 if (!name) return OpenFileMappingW( access, inherit, NULL );
440 if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
442 SetLastError( ERROR_FILENAME_EXCED_RANGE );
443 return 0;
445 return OpenFileMappingW( access, inherit, buffer );
449 /***********************************************************************
450 * OpenFileMappingW (KERNEL32.@)
452 * See OpenFileMappingA.
454 HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
456 OBJECT_ATTRIBUTES attr;
457 UNICODE_STRING nameW;
458 HANDLE ret;
459 NTSTATUS status;
461 if (!name)
463 SetLastError( ERROR_INVALID_PARAMETER );
464 return 0;
466 attr.Length = sizeof(attr);
467 attr.RootDirectory = get_BaseNamedObjects_handle();
468 attr.ObjectName = &nameW;
469 attr.Attributes = inherit ? OBJ_INHERIT : 0;
470 attr.SecurityDescriptor = NULL;
471 attr.SecurityQualityOfService = NULL;
472 RtlInitUnicodeString( &nameW, name );
474 if (access == FILE_MAP_COPY) access = SECTION_MAP_READ;
475 access |= SECTION_QUERY;
477 if (GetVersion() & 0x80000000)
479 /* win9x doesn't do access checks, so try with full access first */
480 if (!NtOpenSection( &ret, access | SECTION_MAP_READ | SECTION_MAP_WRITE, &attr )) return ret;
483 if ((status = NtOpenSection( &ret, access, &attr )))
485 SetLastError( RtlNtStatusToDosError(status) );
486 ret = 0;
488 return ret;
492 /***********************************************************************
493 * MapViewOfFile (KERNEL32.@)
495 * Maps a view of a file into the address space.
497 * PARAMS
498 * mapping [I] File-mapping object to map.
499 * access [I] Access mode.
500 * offset_high [I] High-order 32 bits of file offset.
501 * offset_low [I] Low-order 32 bits of file offset.
502 * count [I] Number of bytes to map.
504 * RETURNS
505 * Success: Starting address of mapped view.
506 * Failure: NULL.
508 LPVOID WINAPI MapViewOfFile( HANDLE mapping, DWORD access,
509 DWORD offset_high, DWORD offset_low, SIZE_T count )
511 return MapViewOfFileEx( mapping, access, offset_high,
512 offset_low, count, NULL );
516 /***********************************************************************
517 * MapViewOfFileEx (KERNEL32.@)
519 * Maps a view of a file into the address space.
521 * PARAMS
522 * handle [I] File-mapping object to map.
523 * access [I] Access mode.
524 * offset_high [I] High-order 32 bits of file offset.
525 * offset_low [I] Low-order 32 bits of file offset.
526 * count [I] Number of bytes to map.
527 * addr [I] Suggested starting address for mapped view.
529 * RETURNS
530 * Success: Starting address of mapped view.
531 * Failure: NULL.
533 LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access,
534 DWORD offset_high, DWORD offset_low, SIZE_T count, LPVOID addr )
536 NTSTATUS status;
537 LARGE_INTEGER offset;
538 ULONG protect;
540 offset.u.LowPart = offset_low;
541 offset.u.HighPart = offset_high;
543 if (access & FILE_MAP_WRITE) protect = PAGE_READWRITE;
544 else if (access & FILE_MAP_COPY) protect = PAGE_WRITECOPY;
545 else protect = PAGE_READONLY;
547 if (access & FILE_MAP_EXECUTE) protect <<= 4;
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;
649 if (!page_size) page_size = getpagesize();
650 __TRY
652 volatile const char *p = ptr;
653 char dummy;
654 UINT count = size;
656 while (count > page_size)
658 dummy = *p;
659 p += page_size;
660 count -= page_size;
662 dummy = p[0];
663 dummy = p[count - 1];
665 __EXCEPT_PAGE_FAULT
667 TRACE_(seh)("%p caused page fault during read\n", ptr);
668 return TRUE;
670 __ENDTRY
671 return FALSE;
675 /***********************************************************************
676 * IsBadWritePtr (KERNEL32.@)
678 * Check for write access on a memory block.
680 * PARAMS
681 * ptr [I] Address of memory block.
682 * size [I] Size of block in bytes.
684 * RETURNS
685 * Success: TRUE.
686 * Failure: FALSE. Process has write access to entire block.
688 BOOL WINAPI IsBadWritePtr( LPVOID ptr, UINT size )
690 if (!size) return FALSE; /* handle 0 size case w/o reference */
691 if (!ptr) return TRUE;
693 if (!page_size) page_size = getpagesize();
694 __TRY
696 volatile char *p = ptr;
697 UINT count = size;
699 while (count > page_size)
701 *p |= 0;
702 p += page_size;
703 count -= page_size;
705 p[0] |= 0;
706 p[count - 1] |= 0;
708 __EXCEPT_PAGE_FAULT
710 TRACE_(seh)("%p caused page fault during write\n", ptr);
711 return TRUE;
713 __ENDTRY
714 return FALSE;
718 /***********************************************************************
719 * IsBadHugeReadPtr (KERNEL32.@)
721 * Check for read access on a memory block.
723 * PARAMS
724 * ptr [I] Address of memory block.
725 * size [I] Size of block.
727 * RETURNS
728 * Success: TRUE.
729 * Failure: FALSE. Process has read access to entire block.
731 BOOL WINAPI IsBadHugeReadPtr( LPCVOID ptr, UINT size )
733 return IsBadReadPtr( ptr, size );
737 /***********************************************************************
738 * IsBadHugeWritePtr (KERNEL32.@)
740 * Check for write access on a memory block.
742 * PARAMS
743 * ptr [I] Address of memory block.
744 * size [I] Size of block.
746 * RETURNS
747 * Success: TRUE.
748 * Failure: FALSE. Process has write access to entire block.
750 BOOL WINAPI IsBadHugeWritePtr( LPVOID ptr, UINT size )
752 return IsBadWritePtr( ptr, size );
756 /***********************************************************************
757 * IsBadCodePtr (KERNEL32.@)
759 * Check for read access on a memory address.
761 * PARAMS
762 * ptr [I] Address of function.
764 * RETURNS
765 * Success: TRUE.
766 * Failure: FALSE. Process has read access to specified memory.
768 BOOL WINAPI IsBadCodePtr( FARPROC ptr )
770 return IsBadReadPtr( ptr, 1 );
774 /***********************************************************************
775 * IsBadStringPtrA (KERNEL32.@)
777 * Check for read access on a range of memory pointed to by a string pointer.
779 * PARAMS
780 * str [I] Address of string.
781 * max [I] Maximum size of string.
783 * RETURNS
784 * Success: TRUE.
785 * Failure: FALSE. Read access to all bytes in string.
787 BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT max )
789 if (!str) return TRUE;
791 __TRY
793 volatile const char *p = str;
794 while (p != str + max) if (!*p++) break;
796 __EXCEPT_PAGE_FAULT
798 TRACE_(seh)("%p caused page fault during read\n", str);
799 return TRUE;
801 __ENDTRY
802 return FALSE;
806 /***********************************************************************
807 * IsBadStringPtrW (KERNEL32.@)
809 * See IsBadStringPtrA.
811 BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max )
813 if (!str) return TRUE;
815 __TRY
817 volatile const WCHAR *p = str;
818 while (p != str + max) if (!*p++) break;
820 __EXCEPT_PAGE_FAULT
822 TRACE_(seh)("%p caused page fault during read\n", str);
823 return TRUE;
825 __ENDTRY
826 return FALSE;
829 /***********************************************************************
830 * K32GetMappedFileNameA (KERNEL32.@)
832 DWORD WINAPI K32GetMappedFileNameA(HANDLE process, LPVOID lpv, LPSTR file_name, DWORD size)
834 FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
836 if (file_name && size)
837 file_name[0] = '\0';
839 return 0;
842 /***********************************************************************
843 * K32GetMappedFileNameW (KERNEL32.@)
845 DWORD WINAPI K32GetMappedFileNameW(HANDLE process, LPVOID lpv, LPWSTR file_name, DWORD size)
847 FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
849 if (file_name && size)
850 file_name[0] = '\0';
852 return 0;
855 /***********************************************************************
856 * K32EnumPageFilesA (KERNEL32.@)
858 BOOL WINAPI K32EnumPageFilesA( PENUM_PAGE_FILE_CALLBACKA callback, LPVOID context )
860 FIXME_(file)("(%p, %p) stub\n", callback, context );
861 return FALSE;
864 /***********************************************************************
865 * K32EnumPageFilesW (KERNEL32.@)
867 BOOL WINAPI K32EnumPageFilesW( PENUM_PAGE_FILE_CALLBACKW callback, LPVOID context )
869 FIXME_(file)("(%p, %p) stub\n", callback, context );
870 return FALSE;
873 /***********************************************************************
874 * K32GetWsChanges (KERNEL32.@)
876 BOOL WINAPI K32GetWsChanges(HANDLE process, PPSAPI_WS_WATCH_INFORMATION watchinfo, DWORD size)
878 NTSTATUS status;
880 TRACE_(seh)("(%p, %p, %d)\n", process, watchinfo, size);
882 status = NtQueryInformationProcess( process, ProcessWorkingSetWatch, watchinfo, size, NULL );
884 if (status)
886 SetLastError( RtlNtStatusToDosError( status ) );
887 return FALSE;
889 return TRUE;
892 /***********************************************************************
893 * K32InitializeProcessForWsWatch (KERNEL32.@)
895 BOOL WINAPI K32InitializeProcessForWsWatch(HANDLE process)
897 FIXME_(seh)("(process=%p): stub\n", process);
899 return TRUE;