Skip to content

Commit

Permalink
SecurityPlugin use MultiByteToWideChar rather than sqUTF8toUTF16Copy
Browse files Browse the repository at this point in the history
The former is the standard and correct implementation
The later is a naive stub

Note: as an internal plugin, we could rather just copy imagePathW...
[skip travis] because sole changes are in platforms/win32
  • Loading branch information
nicolas-cellier-aka-nice committed Jan 3, 2019
1 parent 01cbedd commit ec2e7e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions platforms/win32/plugins/SecurityPlugin/sqWin32Security.c
Expand Up @@ -240,7 +240,7 @@ sqInt ioInitSecurity(void) {
int dirLen;

/* establish the secure user directory */
sqUTF8ToUTF16Copy(secureUserDirectory, sizeof(secureUserDirectory)/sizeof(secureUserDirectory[0]), sqGetCurrentImagePath());
MultiByteToWideChar(CP_UTF8,0, sqGetCurrentImagePath(),-1,secureUserDirectory, MAX_PATH );
dirLen = wcslen(secureUserDirectory);
dwSize = MAX_PATH-dirLen;
GetUserNameW(secureUserDirectory+dirLen, &dwSize);
Expand All @@ -249,7 +249,7 @@ sqInt ioInitSecurity(void) {
wcscpy(untrustedUserDirectory, L"C:\\My Squeak\\%USERNAME%");

/* establish untrusted user directory */
sqUTF8ToUTF16Copy(resourceDirectory, sizeof(resourceDirectory) / sizeof(resourceDirectory[0]), sqGetCurrentImagePath());
MultiByteToWideChar(CP_UTF8, 0, sqGetCurrentImagePath(), -1, resourceDirectory, MAX_PATH);
if (resourceDirectory[wcslen(resourceDirectory)-1] == '\\') {
resourceDirectory[wcslen(resourceDirectory)-1] = 0;
}
Expand Down

0 comments on commit ec2e7e9

Please sign in to comment.