Skip to content

Commit fe37c18

Browse files
committed
explicitly call wide character variations of functions
1 parent 5673205 commit fe37c18

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

main.c

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
#include "main.h"
22

3-
static
4-
HANDLE
5-
ds_open_handle(
6-
PWCHAR pwPath
7-
)
3+
static HANDLE ds_open_handle(PWCHAR pwPath)
84
{
9-
return CreateFile(pwPath, GENERIC_READ | SYNCHRONIZE | DELETE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
5+
return CreateFileW(pwPath, GENERIC_READ | SYNCHRONIZE | DELETE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
106
}
117

12-
static
13-
BOOL
14-
ds_rename_handle(
15-
HANDLE hHandle
16-
)
8+
static BOOL ds_rename_handle(HANDLE hHandle)
179
{
1810
FILE_RENAME_INFO fRename;
1911
RtlSecureZeroMemory(&fRename, sizeof(fRename));
@@ -26,11 +18,7 @@ ds_rename_handle(
2618
return SetFileInformationByHandle(hHandle, FileRenameInfo, &fRename, sizeof(fRename) + sizeof(lpwStream));
2719
}
2820

29-
static
30-
BOOL
31-
ds_deposite_handle(
32-
HANDLE hHandle
33-
)
21+
static BOOL ds_deposite_handle(HANDLE hHandle)
3422
{
3523
// set FILE_DISPOSITION_INFO::DeleteFile to TRUE
3624
FILE_DISPOSITION_INFO fDelete;
@@ -41,17 +29,13 @@ ds_deposite_handle(
4129
return SetFileInformationByHandle(hHandle, FileDispositionInfo, &fDelete, sizeof(fDelete));
4230
}
4331

44-
int
45-
main(
46-
int argc,
47-
char** argv
48-
)
32+
int main(int argc, char** argv)
4933
{
5034
WCHAR wcPath[MAX_PATH + 1];
5135
RtlSecureZeroMemory(wcPath, sizeof(wcPath));
5236

5337
// get the path to the current running process ctx
54-
if (GetModuleFileName(NULL, wcPath, MAX_PATH) == 0)
38+
if (GetModuleFileNameW(NULL, wcPath, MAX_PATH) == 0)
5539
{
5640
DS_DEBUG_LOG(L"failed to get the current module handle");
5741
return 0;
@@ -83,7 +67,6 @@ main(
8367
return 0;
8468
}
8569

86-
// set deposition on HANDLE
8770
if (!ds_deposite_handle(hCurrent))
8871
{
8972
DS_DEBUG_LOG(L"failed to set delete deposition");
@@ -95,7 +78,7 @@ main(
9578
CloseHandle(hCurrent);
9679

9780
// verify we've been deleted
98-
if (PathFileExists(wcPath))
81+
if (PathFileExistsW(wcPath))
9982
{
10083
DS_DEBUG_LOG(L"failed to delete copy, file still exists");
10184
return 0;

0 commit comments

Comments
 (0)