1 #if !defined(PP_WINAPI_H_INCLUDED) && defined(_WIN32) 2 #define PP_WINAPI_H_INCLUDED 4 #ifdef WINAPI_FAMILY_PARTITION 6 #if ! WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 10 if (bManualReset) flags |= CREATE_EVENT_MANUAL_RESET;
11 if (bInitialState) flags |= CREATE_EVENT_INITIAL_SET;
12 DWORD rights = SYNCHRONIZE | EVENT_MODIFY_STATE;
13 return CreateEventEx(lpEventAttributes, lpName, flags, rights);
17 return WaitForSingleObjectEx(hHandle, dwMilliseconds, FALSE);
21 return WaitForMultipleObjectsEx(nCount, lpHandles, bWaitAll, dwMilliseconds, FALSE);
25 InitializeCriticalSectionEx(lpCriticalSection, 0, 0);
29 return FindFirstFileEx(lpFileName, FindExInfoStandard, lpFindFileData, FindExSearchNameMatch, NULL, 0);
33 FILE_STANDARD_INFO
info;
34 if (!GetFileInformationByHandleEx(hFile, FileStandardInfo, &info,
sizeof(info)))
return FALSE;
35 *lpFileSize = info.EndOfFile;
39 inline HANDLE CreateFileW(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile) {
40 CREATEFILE2_EXTENDED_PARAMETERS arg = {};
41 arg.dwSize =
sizeof(arg);
42 arg.hTemplateFile = hTemplateFile;
43 arg.lpSecurityAttributes = lpSecurityAttributes;
44 arg.dwFileAttributes = dwFlagsAndAttributes & 0x0000FFFF;
45 arg.dwFileFlags = dwFlagsAndAttributes & 0xFFFF0000;
46 return CreateFile2(lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, &arg);
50 WIN32_FILE_ATTRIBUTE_DATA data = {};
51 if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data))
return 0xFFFFFFFF;
52 return data.dwFileAttributes;
55 #define GetFileAttributes GetFileAttributesW 57 #endif // #if ! WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 59 #endif // #ifdef WINAPI_FAMILY_PARTITION 61 #endif // !defined(PP_WINAPI_H_INCLUDED) && defined(_WIN32) DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAll, DWORD dwMilliseconds)
DWORD GetFileAttributesW(const wchar_t *path)
HANDLE CreateFileW(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
void info(const char *p_message)
typedef BOOL(WINAPI *pPowerSetRequest_t)(__in HANDLE PowerRequest
typedef HANDLE(WINAPI *pPowerCreateRequest_t)(__in void *Context)
BOOL GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize)
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
void InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
HANDLE FindFirstFile(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
HANDLE CreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCTSTR lpName)