25 #define WIN32_NO_STATUS 31 #include "wine/winternl.h" 34 #define PSAPI_VERSION 1 41 static BOOL (
WINAPI *pWow64DisableWow64FsRedirection)(
void **);
42 static BOOL (
WINAPI *pWow64RevertWow64FsRedirection)(
void *);
66 ok(cbUsed == 0,
"cbUsed=%d\n", cbUsed);
71 ok(cbUsed == 4,
"cbUsed=%d\n", cbUsed);
76 char buffer[200] =
"C:\\windows\\system32\\notepad.exe";
92 hMod = (
void *)0xdeadbeef;
94 ok(!
ret,
"succeeded\n");
98 hMod = (
void *)0xdeadbeef;
100 ok(!
ret,
"succeeded\n");
111 ok(!
ret,
"succeeded\n");
115 hMod = (
void *)0xdeadbeef;
120 ok(cbNeeded %
sizeof(hMod) == 0,
"not a multiple of sizeof(HMODULE) cbNeeded=%d\n", cbNeeded);
126 ok(!
ret,
"wait timed out\n");
132 ok(!!hMod,
"expected non-NULL module\n");
133 ok(cbNeeded %
sizeof(hMod) == 0,
"got %u\n", cbNeeded);
137 if (
sizeof(
void *) == 8)
147 ok(!
ret,
"wait timed out\n");
153 ok(!!hMod,
"expected non-NULL module\n");
154 ok(cbNeeded %
sizeof(hMod) == 0,
"got %u\n", cbNeeded);
167 ok(
info.lpBaseOfDll == hMod,
"expected %p, got %p\n", hMod,
info.lpBaseOfDll);
168 ok(
info.SizeOfImage,
"image size was 0\n");
169 ok(
info.EntryPoint >=
info.lpBaseOfDll,
"got entry point %p\n",
info.EntryPoint);
175 pWow64DisableWow64FsRedirection(&
cookie);
177 pWow64RevertWow64FsRedirection(
cookie);
181 ok(!
ret,
"wait timed out\n");
218 ok(
info.lpBaseOfDll == hMod,
"lpBaseOfDll=%p hMod=%p\n",
info.lpBaseOfDll, hMod);
226 for (tmp = (
DWORD *)hMod;
info.SizeOfImage;
info.SizeOfImage--)
235 return (perf >=
max(sysperf, margin) - margin && perf <= sysperf + margin);
247 ok(!
ret,
"GetPerformanceInfo unexpectedly succeeded\n");
250 if (!pNtQuerySystemInformation)
251 win_skip(
"NtQuerySystemInformation not found, skipping tests\n");
272 "expected approximately %ld but got %d\n",
info.CommitTotal, sys_performance_info->TotalCommittedPages);
275 "expected approximately %ld but got %d\n",
info.CommitLimit, sys_performance_info->TotalCommitLimit);
278 "expected approximately %ld but got %d\n",
info.CommitPeak, sys_performance_info->PeakCommitment);
281 "expected approximately %ld but got %d\n",
info.PhysicalAvailable, sys_performance_info->AvailablePages);
285 ok(
check_with_margin(
info.KernelTotal, sys_performance_info->PagedPoolUsage + sys_performance_info->NonPagedPoolUsage, 256),
286 "expected approximately %ld but got %d\n",
info.KernelTotal,
287 sys_performance_info->PagedPoolUsage + sys_performance_info->NonPagedPoolUsage);
290 "expected approximately %ld but got %d\n",
info.KernelPaged, sys_performance_info->PagedPoolUsage);
293 "expected approximately %ld but got %d\n",
info.KernelNonpaged, sys_performance_info->NonPagedPoolUsage);
301 ok(
info.PhysicalTotal == sys_basic_info.MmNumberOfPhysicalPages,
302 "expected info.PhysicalTotal=%u but got %u\n",
303 sys_basic_info.MmNumberOfPhysicalPages, (
ULONG)
info.PhysicalTotal);
306 "expected info.PageSize=%u but got %u\n",
317 ok(sys_process_info !=
NULL,
"failed to allocate memory\n");
328 handle_count += spi->HandleCount;
330 if (spi->NextEntryOffset == 0)
break;
335 "expected approximately %d but got %d\n",
info.HandleCount, handle_count);
338 "expected approximately %d but got %d\n",
info.ProcessCount, process_count);
353 ok(!
ret,
"GetProcessMemoryInfo should fail\n");
358 ok(!
ret,
"GetProcessMemoryInfo should fail\n");
363 ok(!
ret,
"GetProcessMemoryInfo should fail\n");
378 if (!pNtQueryVirtualMemory)
return FALSE;
390 ok((
char *)section_name->
SectionFileName.
Buffer == (
char *)section_name +
sizeof(*section_name),
"got %p, %p\n",
418 ok(!
ret,
"GetMappedFileName should fail\n");
423 ok(!
ret,
"GetMappedFileName should fail\n");
429 "GetMappedFileNameA failed with error %u\n",
GetLastError() );
432 ok(
ret ==
strlen(szMapPath),
"szMapPath=\"%s\" ret=%d\n", szMapPath,
ret);
433 ok(szMapPath[0] ==
'\\',
"szMapPath=\"%s\"\n", szMapPath);
434 szMapBaseName =
strrchr(szMapPath,
'\\');
435 ok(szMapBaseName && *szMapBaseName,
"szMapPath=\"%s\"\n", szMapPath);
440 "szModPath=\"%s\" szMapBaseName=\"%s\"\n", szModPath, szMapBaseName);
471 ok(!
ret,
"GetMappedFileName should fail\n");
477 ok(!
ret,
"GetMappedFileName should fail\n");
483 ok(!map_name[0] ||
broken(map_name[0] ==
device_name[0]) ,
"expected 0, got %c\n", map_name[0]);
499 ok(
memcmp(map_nameW, nt_map_name,
lstrlenW(map_nameW)) == 0,
"map name does not start with a device name: %s\n", map_name);
511 ok(
memcmp(map_nameW, nt_map_name,
lstrlenW(map_nameW)) == 0,
"map name does not start with a device name: %s\n", map_name);
524 ok(!
ret,
"GetMappedFileName should fail\n");
529 ok(!
ret,
"GetMappedFileName should fail\n");
535 ok(!
ret,
"GetMappedFileName should fail\n");
553 ok(!
ret,
"GetMappedFileName should fail\n");
573 win_skip(
"GetProcessImageFileName not implemented\n");
600 ok(
ret >=
strlen(szImgPath),
"szImgPath=\"%s\" ret=%d\n", szImgPath,
ret);
601 ok(!
strcmp(szImgPath, szMapPath),
"szImgPath=\"%s\" szMapPath=\"%s\"\n", szImgPath, szMapPath);
618 memset(szImgPathW, 0xff,
sizeof(szImgPathW));
620 ok(
ret > 0,
"GetProcessImageFileNameW should have succeeded.\n");
621 ok(szImgPathW[0] ==
'\\',
"GetProcessImageFileNameW should have returned an NT path.\n");
629 memset(szImgPathW, 0xff,
sizeof(szImgPathW));
631 ok(
ret > 0,
"GetProcessImageFileNameW should have succeeded.\n");
632 ok(szImgPathW[0] ==
'\\',
"GetProcessImageFileNameW should have returned an NT path.\n");
645 ok( !
ret,
"GetModuleFileNameExA succeeded\n" );
650 ok( !
ret,
"GetModuleFileNameExA succeeded\n" );
655 ok( !
ret,
"GetModuleFileNameExA succeeded\n" );
661 ok(
ret ==
strlen(szModExPath),
"szModExPath=\"%s\" ret=%d\n", szModExPath,
ret);
664 "szModExPath=\"%s\" szModPath=\"%s\"\n", szModExPath, szModPath);
667 memset( szModExPath, 0xcc,
sizeof(szModExPath) );
671 "szModExPath=\"%s\" ret=%d\n", szModExPath,
ret );
678 ok(
ret == 0,
"wrong length %u\n",
ret );
695 ok(
ret == 0,
"wrong length %u\n",
ret );
722 ok(
ret ==
strlen(szModBaseName),
"szModBaseName=\"%s\" ret=%d\n", szModBaseName,
ret);
725 "szModPath=\"%s\" szModBaseName=\"%s\"\n", szModPath, szModBaseName);
760 trace(
"InitializeProcessForWsWatch not supported\n" );
785 for(
i = 0;
i < pages[0];
i++)
792 todo_wine ok(0,
"QueryWorkingSet didn't find our page\n");
808 todo_wine ok(0,
"GetWsChanges didn't find our page\n");
enum _SYSTEM_INFORMATION_CLASS SYSTEM_INFORMATION_CLASS
#define ERROR_INVALID_PARAMETER
static void test_GetModuleFileNameEx(void)
static void test_GetPerformanceInfo(void)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define STATUS_INFO_LENGTH_MISMATCH
#define WideCharToMultiByte
#define PROCESS_QUERY_INFORMATION
ACPI_SIZE strlen(const char *String)
#define ERROR_INVALID_FUNCTION
char * wine_dbgstr_w(const wchar_t *wstr)
BOOL NTAPI VirtualLock(IN LPVOID lpAddress, IN SIZE_T dwSize)
BOOL WINAPI SetEndOfFile(HANDLE hFile)
DWORD WINAPI GetModuleBaseNameA(HANDLE hProcess, HMODULE hModule, LPSTR lpBaseName, DWORD nSize)
#define ERROR_INVALID_HANDLE
static const WCHAR device_name[]
BOOL WINAPI InitializeProcessForWsWatch(HANDLE hProcess)
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
static void test_GetProcessMemoryInfo(void)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
GLenum GLuint GLenum GLsizei const GLchar * buf
static void test_GetProcessImageFileName(void)
#define DUPLICATE_SAME_ACCESS
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
#define ERROR_ACCESS_DENIED
static struct _test_info info[]
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
#define ERROR_PARTIAL_COPY
BOOL WINAPI EmptyWorkingSet(HANDLE hProcess)
#define GetModuleFileNameExW(w, x, y, z)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
static BOOL init_func_ptrs(void)
#define SystemPerformanceInformation
static void test_EnumProcessModules(void)
#define PROCESS_SET_QUOTA
DWORD WINAPI GetModuleFileNameExA(HANDLE hProcess, HMODULE hModule, LPSTR lpFilename, DWORD nSize)
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
BOOL WINAPI GetPerformanceInfo(PPERFORMANCE_INFORMATION pPerformanceInformation, DWORD cb)
DWORD WINAPI GetMappedFileNameW(HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename, DWORD nSize)
BOOL WINAPI EnumProcessModules(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
DWORD WINAPI QueryDosDeviceA(LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static void test_ws_functions(void)
DWORD WINAPI GetProcessImageFileNameA(HANDLE hProcess, LPSTR lpImageFileName, DWORD nSize)
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
#define ERROR_UNEXP_NET_ERR
UNICODE_STRING SectionFileName
GLenum const GLvoid * addr
#define memcpy(s1, s2, n)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
#define GetCurrentProcess()
static uint32_t thread_count(IN pnfs_layout_state *state, IN enum pnfs_iomode iomode, IN uint64_t offset, IN uint64_t length)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static BOOL nt_get_mapped_file_name(HANDLE process, LPVOID addr, LPWSTR name, DWORD len)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
BOOL WINAPI EnumProcesses(DWORD *lpidProcess, DWORD cb, LPDWORD lpcbNeeded)
static void test_EnumProcesses(void)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
BOOL WINAPI GetModuleInformation(HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb)
static void test_GetMappedFileName(void)
#define ERROR_FILE_INVALID
static BOOL check_with_margin(SIZE_T perf, SIZE_T sysperf, int margin)
DWORD WINAPI WaitForInputIdle(_In_ HANDLE, _In_ DWORD)
DWORD WINAPI GetProcessImageFileNameW(HANDLE hProcess, LPWSTR lpImageFileName, DWORD nSize)
char * strcpy(char *DstString, const char *SrcString)
#define STANDARD_RIGHTS_REQUIRED
BOOL WINAPI QueryWorkingSet(HANDLE hProcess, PVOID pv, DWORD cb)
int strcmp(const char *String1, const char *String2)
#define GetProcAddress(x, y)
#define PROCESS_SET_INFORMATION
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
BOOL WINAPI GetProcessMemoryInfo(HANDLE Process, PPROCESS_MEMORY_COUNTERS ppsmemCounters, DWORD cb)
static void test_GetModuleInformation(void)
BOOL WINAPI GetWsChanges(HANDLE hProcess, PPSAPI_WS_WATCH_INFORMATION lpWatchInfo, DWORD cb)
#define CreateFileA(a, b, c, d, e, f, g)
static SIZE_T *static BOOL(WINAPI *pIsWow64Process)(HANDLE
static NTSTATUS(WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS
static SERVICE_STATUS status
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
#define HeapFree(x, y, z)
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
DWORD WINAPI GetCurrentProcessId(VOID)
static void test_GetModuleBaseName(void)
#define ERROR_INSUFFICIENT_BUFFER
DWORD WINAPI GetMappedFileNameA(HANDLE hProcess, LPVOID lpv, LPSTR lpFilename, DWORD nSize)