Skip to content

Commit

Permalink
Use port_file_get_unicode_path() to covert cache file path to Unicode.
Browse files Browse the repository at this point in the history
On Windows, "\\?\" needs to be prepended to the path if its length is >
MAX_PATH. port_convertFromUTF8() won't prepend "\\?\". Call
port_file_get_unicode_path() so that "\\?\" is prepended.  

Closes eclipse-openj9#4351

Signed-off-by: hangshao <[email protected]>
  • Loading branch information
hangshao0 committed Feb 14, 2019
1 parent c37238a commit f9d53e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/port/win32/j9shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ j9shmem_stat(struct J9PortLibrary *portLibrary, const char* cacheDirName, uintpt
sharedMemoryFullPath = getSharedMemoryPathandFileName(portLibrary, cacheDirName, name);

/* Convert the filename from UTF8 to Unicode */
unicodePath = port_convertFromUTF8(OMRPORTLIB, sharedMemoryFullPath, unicodeBuffer, UNICODE_BUFFER_SIZE);
unicodePath = port_file_get_unicode_path(OMRPORTLIB, sharedMemoryFullPath, unicodeBuffer, UNICODE_BUFFER_SIZE);
if (NULL == unicodePath) {
omrmem_free_memory(sharedMemoryFullPath);
Trc_PRT_shmem_j9shmem_stat_unicodePathNull();
Expand Down Expand Up @@ -647,7 +647,7 @@ createMappedFile(struct J9PortLibrary* portLibrary, const char* cacheDirName , s
Trc_PRT_shmem_createMappedFile_fileCreateSucceeded();

/* Convert the filename from UTF8 to Unicode */
unicodePath = port_convertFromUTF8(OMRPORTLIB, shareMemoryFileName, unicodeBuffer, UNICODE_BUFFER_SIZE);
unicodePath = port_file_get_unicode_path(OMRPORTLIB, shareMemoryFileName, unicodeBuffer, UNICODE_BUFFER_SIZE);
if (NULL != unicodePath) {
/* MoveFileEx allows us to delete the share cache after the next reboot */
MoveFileExW(unicodePath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
Expand Down

0 comments on commit f9d53e3

Please sign in to comment.