oleaut32: COM clean up of ITypeLib2 interface implementation.
[wine.git] / dlls / kernel32 / virtual.c
blob0470073be150965d80c17f86b55b72c7900abbbb
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);
52 /***********************************************************************
53 * VirtualAlloc (KERNEL32.@)
55 * Reserves or commits a region of pages in virtual address space.
57 * PARAMS
58 * addr [I] Address of region to reserve or commit.
59 * size [I] Size of region.
60 * type [I] Type of allocation.
61 * protect [I] Type of access protection.
63 * RETURNS
64 * Success: Base address of allocated region of pages.
65 * Failure: NULL.
67 LPVOID WINAPI VirtualAlloc( LPVOID addr, SIZE_T size, DWORD type, DWORD protect )
69 return VirtualAllocEx( GetCurrentProcess(), addr, size, type, protect );
73 /***********************************************************************
74 * VirtualAllocEx (KERNEL32.@)
76 * Seems to be just as VirtualAlloc, but with process handle.
78 * PARAMS
79 * hProcess [I] Handle to process to do mem operation.
80 * addr [I] Address of region to reserve or commit.
81 * size [I] Size of region.
82 * type [I] Type of allocation.
83 * protect [I] Type of access protection.
86 * RETURNS
87 * Success: Base address of allocated region of pages.
88 * Failure: NULL.
90 LPVOID WINAPI VirtualAllocEx( HANDLE hProcess, LPVOID addr, SIZE_T size,
91 DWORD type, DWORD protect )
93 LPVOID ret = addr;
94 NTSTATUS status;
96 if ((status = NtAllocateVirtualMemory( hProcess, &ret, 0, &size, type, protect )))
98 SetLastError( RtlNtStatusToDosError(status) );
99 ret = NULL;
101 return ret;
105 /***********************************************************************
106 * VirtualFree (KERNEL32.@)
108 * Releases or decommits a region of pages in virtual address space.
110 * PARAMS
111 * addr [I] Address of region of committed pages.
112 * size [I] Size of region.
113 * type [I] Type of operation.
115 * RETURNS
116 * Success: TRUE.
117 * Failure: FALSE.
119 BOOL WINAPI VirtualFree( LPVOID addr, SIZE_T size, DWORD type )
121 return VirtualFreeEx( GetCurrentProcess(), addr, size, type );
125 /***********************************************************************
126 * VirtualFreeEx (KERNEL32.@)
128 * Releases or decommits a region of pages in virtual address space.
130 * PARAMS
131 * process [I] Handle to process.
132 * addr [I] Address of region to free.
133 * size [I] Size of region.
134 * type [I] Type of operation.
136 * RETURNS
137 * Success: TRUE.
138 * Failure: FALSE.
140 BOOL WINAPI VirtualFreeEx( HANDLE process, LPVOID addr, SIZE_T size, DWORD type )
142 NTSTATUS status = NtFreeVirtualMemory( process, &addr, &size, type );
143 if (status) SetLastError( RtlNtStatusToDosError(status) );
144 return !status;
148 /***********************************************************************
149 * VirtualLock (KERNEL32.@)
151 * Locks the specified region of virtual address space.
153 * PARAMS
154 * addr [I] Address of first byte of range to lock.
155 * size [I] Number of bytes in range to lock.
157 * RETURNS
158 * Success: TRUE.
159 * Failure: FALSE.
161 * NOTES
162 * Always returns TRUE.
165 BOOL WINAPI VirtualLock( LPVOID addr, SIZE_T size )
167 NTSTATUS status = NtLockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
168 if (status) SetLastError( RtlNtStatusToDosError(status) );
169 return !status;
173 /***********************************************************************
174 * VirtualUnlock (KERNEL32.@)
176 * Unlocks a range of pages in the virtual address space.
178 * PARAMS
179 * addr [I] Address of first byte of range.
180 * size [I] Number of bytes in range.
182 * RETURNS
183 * Success: TRUE.
184 * Failure: FALSE.
186 * NOTES
187 * Always returns TRUE.
190 BOOL WINAPI VirtualUnlock( LPVOID addr, SIZE_T size )
192 NTSTATUS status = NtUnlockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
193 if (status) SetLastError( RtlNtStatusToDosError(status) );
194 return !status;
198 /***********************************************************************
199 * VirtualProtect (KERNEL32.@)
201 * Changes the access protection on a region of committed pages.
203 * PARAMS
204 * addr [I] Address of region of committed pages.
205 * size [I] Size of region.
206 * new_prot [I] Desired access protection.
207 * old_prot [O] Address of variable to get old protection.
209 * RETURNS
210 * Success: TRUE.
211 * Failure: FALSE.
213 BOOL WINAPI VirtualProtect( LPVOID addr, SIZE_T size, DWORD new_prot, LPDWORD old_prot)
215 return VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
219 /***********************************************************************
220 * VirtualProtectEx (KERNEL32.@)
222 * Changes the access protection on a region of committed pages in the
223 * virtual address space of a specified process.
225 * PARAMS
226 * process [I] Handle of process.
227 * addr [I] Address of region of committed pages.
228 * size [I] Size of region.
229 * new_prot [I] Desired access protection.
230 * old_prot [O] Address of variable to get old protection.
232 * RETURNS
233 * Success: TRUE.
234 * Failure: FALSE.
236 BOOL WINAPI VirtualProtectEx( HANDLE process, LPVOID addr, SIZE_T size,
237 DWORD new_prot, LPDWORD old_prot )
239 NTSTATUS status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot );
240 if (status) SetLastError( RtlNtStatusToDosError(status) );
241 return !status;
245 /***********************************************************************
246 * VirtualQuery (KERNEL32.@)
248 * Provides info about a range of pages in virtual address space.
250 * PARAMS
251 * addr [I] Address of region.
252 * info [O] Address of info buffer.
253 * len [I] Size of buffer.
255 * RETURNS
256 * Number of bytes returned in information buffer or 0 if
257 * addr >= 0xc0000000 (kernel space).
259 SIZE_T WINAPI VirtualQuery( LPCVOID addr, PMEMORY_BASIC_INFORMATION info,
260 SIZE_T len )
262 return VirtualQueryEx( GetCurrentProcess(), addr, info, len );
266 /***********************************************************************
267 * VirtualQueryEx (KERNEL32.@)
269 * Provides info about a range of pages in virtual address space of a
270 * specified process.
272 * PARAMS
273 * process [I] Handle to process.
274 * addr [I] Address of region.
275 * info [O] Address of info buffer.
276 * len [I] Size of buffer.
278 * RETURNS
279 * Number of bytes returned in information buffer.
281 SIZE_T WINAPI VirtualQueryEx( HANDLE process, LPCVOID addr,
282 PMEMORY_BASIC_INFORMATION info, SIZE_T len )
284 SIZE_T ret;
285 NTSTATUS status;
287 if ((status = NtQueryVirtualMemory( process, addr, MemoryBasicInformation, info, len, &ret )))
289 SetLastError( RtlNtStatusToDosError(status) );
290 ret = 0;
292 return ret;
296 /***********************************************************************
297 * CreateFileMappingA (KERNEL32.@)
299 * Creates a named or unnamed file-mapping object for the specified file.
301 * PARAMS
302 * hFile [I] Handle to the file to map.
303 * sa [I] Optional security attributes.
304 * protect [I] Protection for mapping object.
305 * size_high [I] High-order 32 bits of object size.
306 * size_low [I] Low-order 32 bits of object size.
307 * name [I] Name of file-mapping object.
309 * RETURNS
310 * Success: Handle.
311 * Failure: NULL. Mapping object does not exist.
313 HANDLE WINAPI CreateFileMappingA( HANDLE hFile, SECURITY_ATTRIBUTES *sa,
314 DWORD protect, DWORD size_high, DWORD size_low, LPCSTR name )
316 WCHAR buffer[MAX_PATH];
318 if (!name) return CreateFileMappingW( hFile, sa, protect, size_high, size_low, NULL );
320 if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
322 SetLastError( ERROR_FILENAME_EXCED_RANGE );
323 return 0;
325 return CreateFileMappingW( hFile, sa, protect, size_high, size_low, buffer );
329 /***********************************************************************
330 * CreateFileMappingW (KERNEL32.@)
332 * See CreateFileMappingA.
334 HANDLE WINAPI CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES sa,
335 DWORD protect, DWORD size_high,
336 DWORD size_low, LPCWSTR name )
338 static const int sec_flags = SEC_FILE | SEC_IMAGE | SEC_RESERVE | SEC_COMMIT | SEC_NOCACHE;
340 HANDLE ret;
341 NTSTATUS status;
342 DWORD access, sec_type;
343 LARGE_INTEGER size;
345 sec_type = protect & sec_flags;
346 protect &= ~sec_flags;
347 if (!sec_type) sec_type = SEC_COMMIT;
349 /* Win9x compatibility */
350 if (!protect && (GetVersion() & 0x80000000)) protect = PAGE_READONLY;
352 switch(protect)
354 case PAGE_READONLY:
355 case PAGE_WRITECOPY:
356 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_EXECUTE;
357 break;
358 case PAGE_READWRITE:
359 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE;
360 break;
361 case PAGE_EXECUTE_READ:
362 case PAGE_EXECUTE_WRITECOPY:
363 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_MAP_EXECUTE_EXPLICIT;
364 break;
365 case PAGE_EXECUTE_READWRITE:
366 access = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE | SECTION_MAP_EXECUTE_EXPLICIT;
367 break;
368 default:
369 SetLastError( ERROR_INVALID_PARAMETER );
370 return 0;
373 if (hFile == INVALID_HANDLE_VALUE)
375 hFile = 0;
376 if (!size_low && !size_high)
378 SetLastError( ERROR_INVALID_PARAMETER );
379 return 0;
383 size.u.LowPart = size_low;
384 size.u.HighPart = size_high;
386 if (sa || name)
388 OBJECT_ATTRIBUTES attr;
389 UNICODE_STRING nameW;
391 attr.Length = sizeof(attr);
392 attr.RootDirectory = 0;
393 attr.ObjectName = NULL;
394 attr.Attributes = OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0);
395 attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
396 attr.SecurityQualityOfService = NULL;
397 if (name)
399 RtlInitUnicodeString( &nameW, name );
400 attr.ObjectName = &nameW;
401 attr.RootDirectory = get_BaseNamedObjects_handle();
403 status = NtCreateSection( &ret, access, &attr, &size, protect, sec_type, hFile );
405 else status = NtCreateSection( &ret, access, NULL, &size, protect, sec_type, hFile );
407 if (status == STATUS_OBJECT_NAME_EXISTS)
408 SetLastError( ERROR_ALREADY_EXISTS );
409 else
410 SetLastError( RtlNtStatusToDosError(status) );
411 return ret;
415 /***********************************************************************
416 * OpenFileMappingA (KERNEL32.@)
418 * Opens a named file-mapping object.
420 * PARAMS
421 * access [I] Access mode.
422 * inherit [I] Inherit flag.
423 * name [I] Name of file-mapping object.
425 * RETURNS
426 * Success: Handle.
427 * Failure: NULL.
429 HANDLE WINAPI OpenFileMappingA( DWORD access, BOOL inherit, LPCSTR name )
431 WCHAR buffer[MAX_PATH];
433 if (!name) return OpenFileMappingW( access, inherit, NULL );
435 if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH ))
437 SetLastError( ERROR_FILENAME_EXCED_RANGE );
438 return 0;
440 return OpenFileMappingW( access, inherit, buffer );
444 /***********************************************************************
445 * OpenFileMappingW (KERNEL32.@)
447 * See OpenFileMappingA.
449 HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
451 OBJECT_ATTRIBUTES attr;
452 UNICODE_STRING nameW;
453 HANDLE ret;
454 NTSTATUS status;
456 if (!name)
458 SetLastError( ERROR_INVALID_PARAMETER );
459 return 0;
461 attr.Length = sizeof(attr);
462 attr.RootDirectory = get_BaseNamedObjects_handle();
463 attr.ObjectName = &nameW;
464 attr.Attributes = inherit ? OBJ_INHERIT : 0;
465 attr.SecurityDescriptor = NULL;
466 attr.SecurityQualityOfService = NULL;
467 RtlInitUnicodeString( &nameW, name );
469 if (access == FILE_MAP_COPY) access = SECTION_MAP_READ;
470 access |= SECTION_QUERY;
472 if (GetVersion() & 0x80000000)
474 /* win9x doesn't do access checks, so try with full access first */
475 if (!NtOpenSection( &ret, access | SECTION_MAP_READ | SECTION_MAP_WRITE, &attr )) return ret;
478 if ((status = NtOpenSection( &ret, access, &attr )))
480 SetLastError( RtlNtStatusToDosError(status) );
481 ret = 0;
483 return ret;
487 /***********************************************************************
488 * MapViewOfFile (KERNEL32.@)
490 * Maps a view of a file into the address space.
492 * PARAMS
493 * mapping [I] File-mapping object to map.
494 * access [I] Access mode.
495 * offset_high [I] High-order 32 bits of file offset.
496 * offset_low [I] Low-order 32 bits of file offset.
497 * count [I] Number of bytes to map.
499 * RETURNS
500 * Success: Starting address of mapped view.
501 * Failure: NULL.
503 LPVOID WINAPI MapViewOfFile( HANDLE mapping, DWORD access,
504 DWORD offset_high, DWORD offset_low, SIZE_T count )
506 return MapViewOfFileEx( mapping, access, offset_high,
507 offset_low, count, NULL );
511 /***********************************************************************
512 * MapViewOfFileEx (KERNEL32.@)
514 * Maps a view of a file into the address space.
516 * PARAMS
517 * handle [I] File-mapping object to map.
518 * access [I] Access mode.
519 * offset_high [I] High-order 32 bits of file offset.
520 * offset_low [I] Low-order 32 bits of file offset.
521 * count [I] Number of bytes to map.
522 * addr [I] Suggested starting address for mapped view.
524 * RETURNS
525 * Success: Starting address of mapped view.
526 * Failure: NULL.
528 LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access,
529 DWORD offset_high, DWORD offset_low, SIZE_T count, LPVOID addr )
531 NTSTATUS status;
532 LARGE_INTEGER offset;
533 ULONG protect;
534 BOOL exec;
536 offset.u.LowPart = offset_low;
537 offset.u.HighPart = offset_high;
539 exec = access & FILE_MAP_EXECUTE;
540 access &= ~FILE_MAP_EXECUTE;
542 if (access == FILE_MAP_COPY)
543 protect = exec ? PAGE_EXECUTE_WRITECOPY : PAGE_WRITECOPY;
544 else if (access & FILE_MAP_WRITE)
545 protect = exec ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
546 else if (access & FILE_MAP_READ)
547 protect = exec ? PAGE_EXECUTE_READ : PAGE_READONLY;
548 else protect = PAGE_NOACCESS;
550 if ((status = NtMapViewOfSection( handle, GetCurrentProcess(), &addr, 0, 0, &offset,
551 &count, ViewShare, 0, protect )) < 0)
553 SetLastError( RtlNtStatusToDosError(status) );
554 addr = NULL;
556 return addr;
560 /***********************************************************************
561 * UnmapViewOfFile (KERNEL32.@)
563 * Unmaps a mapped view of a file.
565 * PARAMS
566 * addr [I] Address where mapped view begins.
568 * RETURNS
569 * Success: TRUE.
570 * Failure: FALSE.
573 BOOL WINAPI UnmapViewOfFile( LPCVOID addr )
575 NTSTATUS status = NtUnmapViewOfSection( GetCurrentProcess(), (void *)addr );
576 if (status) SetLastError( RtlNtStatusToDosError(status) );
577 return !status;
581 /***********************************************************************
582 * FlushViewOfFile (KERNEL32.@)
584 * Writes to the disk a byte range within a mapped view of a file.
586 * PARAMS
587 * base [I] Start address of byte range to flush.
588 * size [I] Number of bytes in range.
590 * RETURNS
591 * Success: TRUE.
592 * Failure: FALSE.
594 BOOL WINAPI FlushViewOfFile( LPCVOID base, SIZE_T size )
596 NTSTATUS status = NtFlushVirtualMemory( GetCurrentProcess(), &base, &size, 0 );
597 if (status)
599 if (status == STATUS_NOT_MAPPED_DATA) status = STATUS_SUCCESS;
600 else SetLastError( RtlNtStatusToDosError(status) );
602 return !status;
606 /***********************************************************************
607 * GetWriteWatch (KERNEL32.@)
609 UINT WINAPI GetWriteWatch( DWORD flags, LPVOID base, SIZE_T size, LPVOID *addresses,
610 ULONG_PTR *count, ULONG *granularity )
612 NTSTATUS status;
614 status = NtGetWriteWatch( GetCurrentProcess(), flags, base, size, addresses, count, granularity );
615 if (status) SetLastError( RtlNtStatusToDosError(status) );
616 return status ? ~0u : 0;
620 /***********************************************************************
621 * ResetWriteWatch (KERNEL32.@)
623 UINT WINAPI ResetWriteWatch( LPVOID base, SIZE_T size )
625 NTSTATUS status;
627 status = NtResetWriteWatch( GetCurrentProcess(), base, size );
628 if (status) SetLastError( RtlNtStatusToDosError(status) );
629 return status ? ~0u : 0;
633 /***********************************************************************
634 * IsBadReadPtr (KERNEL32.@)
636 * Check for read access on a memory block.
638 * ptr [I] Address of memory block.
639 * size [I] Size of block.
641 * RETURNS
642 * Success: TRUE.
643 * Failure: FALSE. Process has read access to entire block.
645 BOOL WINAPI IsBadReadPtr( LPCVOID ptr, UINT size )
647 if (!size) return FALSE; /* handle 0 size case w/o reference */
648 if (!ptr) return TRUE;
649 __TRY
651 volatile const char *p = ptr;
652 char dummy __attribute__((unused));
653 UINT count = size;
655 while (count > system_info.PageSize)
657 dummy = *p;
658 p += system_info.PageSize;
659 count -= system_info.PageSize;
661 dummy = p[0];
662 dummy = p[count - 1];
664 __EXCEPT_PAGE_FAULT
666 TRACE_(seh)("%p caused page fault during read\n", ptr);
667 return TRUE;
669 __ENDTRY
670 return FALSE;
674 /***********************************************************************
675 * IsBadWritePtr (KERNEL32.@)
677 * Check for write access on a memory block.
679 * PARAMS
680 * ptr [I] Address of memory block.
681 * size [I] Size of block in bytes.
683 * RETURNS
684 * Success: TRUE.
685 * Failure: FALSE. Process has write access to entire block.
687 BOOL WINAPI IsBadWritePtr( LPVOID ptr, UINT size )
689 if (!size) return FALSE; /* handle 0 size case w/o reference */
690 if (!ptr) return TRUE;
691 __TRY
693 volatile char *p = ptr;
694 UINT count = size;
696 while (count > system_info.PageSize)
698 *p |= 0;
699 p += system_info.PageSize;
700 count -= system_info.PageSize;
702 p[0] |= 0;
703 p[count - 1] |= 0;
705 __EXCEPT_PAGE_FAULT
707 TRACE_(seh)("%p caused page fault during write\n", ptr);
708 return TRUE;
710 __ENDTRY
711 return FALSE;
715 /***********************************************************************
716 * IsBadHugeReadPtr (KERNEL32.@)
718 * Check for read access on a memory block.
720 * PARAMS
721 * ptr [I] Address of memory block.
722 * size [I] Size of block.
724 * RETURNS
725 * Success: TRUE.
726 * Failure: FALSE. Process has read access to entire block.
728 BOOL WINAPI IsBadHugeReadPtr( LPCVOID ptr, UINT size )
730 return IsBadReadPtr( ptr, size );
734 /***********************************************************************
735 * IsBadHugeWritePtr (KERNEL32.@)
737 * Check for write access on a memory block.
739 * PARAMS
740 * ptr [I] Address of memory block.
741 * size [I] Size of block.
743 * RETURNS
744 * Success: TRUE.
745 * Failure: FALSE. Process has write access to entire block.
747 BOOL WINAPI IsBadHugeWritePtr( LPVOID ptr, UINT size )
749 return IsBadWritePtr( ptr, size );
753 /***********************************************************************
754 * IsBadCodePtr (KERNEL32.@)
756 * Check for read access on a memory address.
758 * PARAMS
759 * ptr [I] Address of function.
761 * RETURNS
762 * Success: TRUE.
763 * Failure: FALSE. Process has read access to specified memory.
765 BOOL WINAPI IsBadCodePtr( FARPROC ptr )
767 return IsBadReadPtr( ptr, 1 );
771 /***********************************************************************
772 * IsBadStringPtrA (KERNEL32.@)
774 * Check for read access on a range of memory pointed to by a string pointer.
776 * PARAMS
777 * str [I] Address of string.
778 * max [I] Maximum size of string.
780 * RETURNS
781 * Success: TRUE.
782 * Failure: FALSE. Read access to all bytes in string.
784 BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT max )
786 if (!str) return TRUE;
788 __TRY
790 volatile const char *p = str;
791 while (p != str + max) if (!*p++) break;
793 __EXCEPT_PAGE_FAULT
795 TRACE_(seh)("%p caused page fault during read\n", str);
796 return TRUE;
798 __ENDTRY
799 return FALSE;
803 /***********************************************************************
804 * IsBadStringPtrW (KERNEL32.@)
806 * See IsBadStringPtrA.
808 BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max )
810 if (!str) return TRUE;
812 __TRY
814 volatile const WCHAR *p = str;
815 while (p != str + max) if (!*p++) break;
817 __EXCEPT_PAGE_FAULT
819 TRACE_(seh)("%p caused page fault during read\n", str);
820 return TRUE;
822 __ENDTRY
823 return FALSE;
826 /***********************************************************************
827 * K32GetMappedFileNameA (KERNEL32.@)
829 DWORD WINAPI K32GetMappedFileNameA(HANDLE process, LPVOID lpv, LPSTR file_name, DWORD size)
831 FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
833 if (file_name && size)
834 file_name[0] = '\0';
836 return 0;
839 /***********************************************************************
840 * K32GetMappedFileNameW (KERNEL32.@)
842 DWORD WINAPI K32GetMappedFileNameW(HANDLE process, LPVOID lpv, LPWSTR file_name, DWORD size)
844 FIXME_(file)("(%p, %p, %p, %d): stub\n", process, lpv, file_name, size);
846 if (file_name && size)
847 file_name[0] = '\0';
849 return 0;
852 /***********************************************************************
853 * K32EnumPageFilesA (KERNEL32.@)
855 BOOL WINAPI K32EnumPageFilesA( PENUM_PAGE_FILE_CALLBACKA callback, LPVOID context )
857 FIXME_(file)("(%p, %p) stub\n", callback, context );
858 return FALSE;
861 /***********************************************************************
862 * K32EnumPageFilesW (KERNEL32.@)
864 BOOL WINAPI K32EnumPageFilesW( PENUM_PAGE_FILE_CALLBACKW callback, LPVOID context )
866 FIXME_(file)("(%p, %p) stub\n", callback, context );
867 return FALSE;
870 /***********************************************************************
871 * K32GetWsChanges (KERNEL32.@)
873 BOOL WINAPI K32GetWsChanges(HANDLE process, PPSAPI_WS_WATCH_INFORMATION watchinfo, DWORD size)
875 NTSTATUS status;
877 TRACE_(seh)("(%p, %p, %d)\n", process, watchinfo, size);
879 status = NtQueryInformationProcess( process, ProcessWorkingSetWatch, watchinfo, size, NULL );
881 if (status)
883 SetLastError( RtlNtStatusToDosError( status ) );
884 return FALSE;
886 return TRUE;
889 /***********************************************************************
890 * K32InitializeProcessForWsWatch (KERNEL32.@)
892 BOOL WINAPI K32InitializeProcessForWsWatch(HANDLE process)
894 FIXME_(seh)("(process=%p): stub\n", process);
896 return TRUE;