fix: msi, explicit wide char api (#7764)

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2024-04-19 00:47:13 +08:00 committed by GitHub
parent ae23f0de03
commit a3c0911529
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,7 @@ UINT __stdcall RemoveInstallFolder(
fileOp.pFrom = installFolder; fileOp.pFrom = installFolder;
fileOp.fFlags = FOF_NOCONFIRMATION | FOF_SILENT; fileOp.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;
nResult = SHFileOperation(&fileOp); nResult = SHFileOperationW(&fileOp);
if (nResult == 0) if (nResult == 0)
{ {
WcaLog(LOGMSG_STANDARD, "The directory \"%ls\" has been deleted.", installFolder); WcaLog(LOGMSG_STANDARD, "The directory \"%ls\" has been deleted.", installFolder);
@ -179,7 +179,7 @@ bool TerminateProcessesByNameW(LPCWSTR processName, LPCWSTR excludeParam)
CloseHandle(process); CloseHandle(process);
} }
} }
} while (Process32Next(snapshot, &processEntry)); } while (Process32NextW(snapshot, &processEntry));
} }
CloseHandle(snapshot); CloseHandle(snapshot);
} }
@ -497,7 +497,7 @@ UINT __stdcall TryDeleteStartupShortcut(__in MSIHANDLE hInstall)
hr = StringCchPrintfW(pwszTemp, 1024, L"%ls%ls.lnk", szStartupDir, szShortcut); hr = StringCchPrintfW(pwszTemp, 1024, L"%ls%ls.lnk", szStartupDir, szShortcut);
ExitOnFailure(hr, "Failed to compose a resource identifier string"); ExitOnFailure(hr, "Failed to compose a resource identifier string");
if (DeleteFile(pwszTemp)) { if (DeleteFileW(pwszTemp)) {
WcaLog(LOGMSG_STANDARD, "Failed to delete startup shortcut of : \"%ls\"", pwszTemp); WcaLog(LOGMSG_STANDARD, "Failed to delete startup shortcut of : \"%ls\"", pwszTemp);
} }
else { else {

View File

@ -12,7 +12,7 @@ bool MyCreateServiceW(LPCWSTR serviceName, LPCWSTR displayName, LPCWSTR binaryPa
SC_HANDLE schService; SC_HANDLE schService;
// Get a handle to the SCM database. // Get a handle to the SCM database.
schSCManager = OpenSCManager( schSCManager = OpenSCManagerW(
NULL, // local computer NULL, // local computer
NULL, // ServicesActive database NULL, // ServicesActive database
SC_MANAGER_ALL_ACCESS); // full access rights SC_MANAGER_ALL_ACCESS); // full access rights
@ -24,7 +24,7 @@ bool MyCreateServiceW(LPCWSTR serviceName, LPCWSTR displayName, LPCWSTR binaryPa
} }
// Create the service // Create the service
schService = CreateService( schService = CreateServiceW(
schSCManager, // SCM database schSCManager, // SCM database
serviceName, // name of service serviceName, // name of service
displayName, // service name to display displayName, // service name to display
@ -100,7 +100,7 @@ bool MyStartServiceW(LPCWSTR serviceName)
return false; return false;
} }
bool success = StartService(hService, 0, NULL); bool success = StartServiceW(hService, 0, NULL);
if (!success) { if (!success) {
WcaLog(LOGMSG_STANDARD, "Failed to start service: %ls", serviceName); WcaLog(LOGMSG_STANDARD, "Failed to start service: %ls", serviceName);
} }