Quake II RTX doxygen  1.0 dev
ascii.c
Go to the documentation of this file.
1 #include <windows.h>
2 
3 HANDLE WINAPI FindFirstFileA(LPCSTR path, LPWIN32_FIND_DATAA data)
4 {
5  WCHAR wbuffer[MAX_PATH];
6  HANDLE ret;
7  WIN32_FIND_DATAW wdata;
8 
9  if (!MultiByteToWideChar(CP_ACP, 0, path, -1, wbuffer, MAX_PATH)) {
10  return INVALID_HANDLE_VALUE;
11  }
12 
13  ret = FindFirstFileW(wbuffer, &wdata);
14  if (ret != INVALID_HANDLE_VALUE) {
15  memcpy(data, &wdata, FIELD_OFFSET(WIN32_FIND_DATAA, cFileName));
16  WideCharToMultiByte(CP_ACP, 0, wdata.cFileName, -1, data->cFileName, MAX_PATH, NULL, NULL);
17  }
18 
19  return ret;
20 }
21 
22 BOOL WINAPI FindNextFileA(HANDLE handle, LPWIN32_FIND_DATAA data)
23 {
24  BOOL ret;
25  WIN32_FIND_DATAW wdata;
26 
27  ret = FindNextFileW(handle, &wdata);
28  if (ret != FALSE) {
29  memcpy(data, &wdata, FIELD_OFFSET(WIN32_FIND_DATAA, cFileName));
30  WideCharToMultiByte(CP_ACP, 0, wdata.cFileName, -1, data->cFileName, MAX_PATH, NULL, NULL);
31  }
32 
33  return ret;
34 }
35 
36 HINSTANCE WINAPI LoadLibraryA(LPCSTR path)
37 {
38  WCHAR wbuffer[MAX_PATH];
39 
40  if (!MultiByteToWideChar(CP_ACP, 0, path, -1, wbuffer, MAX_PATH)) {
41  return NULL;
42  }
43 
44  return LoadLibraryW(wbuffer);
45 }
46 
47 int WINAPI MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)
48 {
49  WCHAR wText[4096];
50  WCHAR wCaption[256];
51 
52  if (!MultiByteToWideChar(CP_ACP, 0, lpText, -1, wText, 4096)) {
53  return 0;
54  }
55  if (!MultiByteToWideChar(CP_ACP, 0, lpCaption, -1, wCaption, 256)) {
56  return 0;
57  }
58 
59  return MessageBoxW(hWnd, wText, wCaption, uType);
60 }
61 
62 BOOL WINAPI CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
63 {
64  WCHAR wbuffer[MAX_PATH];
65 
66  if (!MultiByteToWideChar(CP_ACP, 0, lpPathName, -1, wbuffer, MAX_PATH)) {
67  return FALSE;
68  }
69 
70  return CreateDirectoryW(wbuffer, lpSecurityAttributes);
71 }
72 
73 BOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
74 {
75  WCHAR wbuffer[MAX_PATH];
76 
77  if (!MultiByteToWideChar(CP_ACP, 0, lpFileName, -1, wbuffer, MAX_PATH)) {
78  return FALSE;
79  }
80 
81  return GetFileAttributesExW(wbuffer, fInfoLevelId, lpFileInformation);
82 }
83 
84 DWORD WINAPI GetModuleFileNameA(HMODULE hModule, LPSTR lpFileName, DWORD nSize)
85 {
86  WCHAR wbuffer[MAX_PATH];
87  DWORD ret;
88 
89  if (nSize > MAX_PATH) {
90  nSize = MAX_PATH;
91  }
92 
93  ret = GetModuleFileNameW(hModule, wbuffer, nSize);
94  if (ret) {
95  if (!WideCharToMultiByte(CP_ACP, 0, wbuffer, ret, lpFileName, ret, NULL, NULL)) {
96  return 0;
97  }
98  }
99 
100  return ret;
101 }
102 
handle
static void * handle
Definition: dynamic.c:52
FindNextFileA
BOOL WINAPI FindNextFileA(HANDLE handle, LPWIN32_FIND_DATAA data)
Definition: ascii.c:22
CreateDirectoryA
BOOL WINAPI CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: ascii.c:62
BOOL
BOOL(WINAPI *qwglSetPixelFormat)(HDC
UINT
CONST PIXELFORMATDESCRIPTOR UINT
Definition: wgl.c:26
FindFirstFileA
HANDLE WINAPI FindFirstFileA(LPCSTR path, LPWIN32_FIND_DATAA data)
Definition: ascii.c:3
GetModuleFileNameA
DWORD WINAPI GetModuleFileNameA(HMODULE hModule, LPSTR lpFileName, DWORD nSize)
Definition: ascii.c:84
MessageBoxA
int WINAPI MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)
Definition: ascii.c:47
LoadLibraryA
HINSTANCE WINAPI LoadLibraryA(LPCSTR path)
Definition: ascii.c:36
GetFileAttributesExA
BOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: ascii.c:73