{"action":"closed","issue":{"url":"https://api.github.com/repos/rn10950/RetroZilla/issues/9","repository_url":"https://api.github.com/repos/rn10950/RetroZilla","labels_url":"https://api.github.com/repos/rn10950/RetroZilla/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/rn10950/RetroZilla/issues/9/comments","events_url":"https://api.github.com/repos/rn10950/RetroZilla/issues/9/events","html_url":"https://github.com/rn10950/RetroZilla/issues/9","id":263486442,"node_id":"MDU6SXNzdWUyNjM0ODY0NDI=","number":9,"title":"Re-apply SHGetSpecialFolderPath fix","user":{"login":"roytam1","id":1192577,"node_id":"MDQ6VXNlcjExOTI1Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/1192577?v=4","gravatar_id":"","url":"https://api.github.com/users/roytam1","html_url":"https://github.com/roytam1","followers_url":"https://api.github.com/users/roytam1/followers","following_url":"https://api.github.com/users/roytam1/following{/other_user}","gists_url":"https://api.github.com/users/roytam1/gists{/gist_id}","starred_url":"https://api.github.com/users/roytam1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roytam1/subscriptions","organizations_url":"https://api.github.com/users/roytam1/orgs","repos_url":"https://api.github.com/users/roytam1/repos","events_url":"https://api.github.com/users/roytam1/events{/privacy}","received_events_url":"https://api.github.com/users/roytam1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-10-06T15:33:03Z","updated_at":"2018-06-14T07:40:01Z","closed_at":"2018-06-14T07:40:01Z","author_association":"CONTRIBUTOR","body":"We need to re-apply SHGetSpecialFolderPath fix after updating NSPR/NSS.\r\nhttps://github.com/rn10950/RetroZilla/blob/85dabb883ee3bdbb1743b46a36fe8d6ed6da4731/security/nss/lib/freebl/win_rand.c#L135\r\n\r\n```\r\n--- win_rand.c\t2009-07-27 19:34:15 -0400\r\n+++ win_rand.c\t2011-09-05 17:55:38 -0400\r\n@@ -177,33 +177,50 @@ EnumSystemFilesInFolder(Handler func, PR\r\n     FindClose(lFindHandle);\r\n }\r\n \r\n-static BOOL\r\n-EnumSystemFiles(Handler func)\r\n-{\r\n-    PRUnichar szSysDir[_MAX_PATH];\r\n-    static const int folders[] = {\r\n-    \tCSIDL_BITBUCKET,  \r\n-\tCSIDL_RECENT,\r\n-#ifndef WINCE\t\t     \r\n-\tCSIDL_INTERNET_CACHE, \r\n-\tCSIDL_HISTORY,\r\n-#endif\r\n-\t0\r\n-    };\r\n-    int i = 0;\r\n-    if (_MAX_PATH > (i = GetTempPathW(_MAX_PATH, szSysDir))) {\r\n-        if (i > 0 && szSysDir[i-1] == L'\\\\')\r\n-\t    szSysDir[i-1] = L'\\0'; // we need to lop off the trailing slash\r\n-        EnumSystemFilesInFolder(func, szSysDir, MAX_DEPTH);\r\n-    }\r\n-    for(i = 0; folders[i]; i++) {\r\n-        DWORD rv = SHGetSpecialFolderPathW(NULL, szSysDir, folders[i], 0);\r\n-        if (szSysDir[0])\r\n-            EnumSystemFilesInFolder(func, szSysDir, MAX_DEPTH);\r\n-        szSysDir[0] =  L'\\0';\r\n-    }\r\n-    return PR_TRUE;\r\n-}\r\n+typedef BOOL \r\n+(WINAPI *SHGetSpecialFolderPathWFn)(\r\n+    HWND hwndOwner,\r\n+    LPWSTR lpszPath,\r\n+    int nFolder,\r\n+    BOOL fCreate);\r\n+\r\n+static BOOL\r\n+EnumSystemFiles(Handler func)\r\n+{\r\n+    HMODULE hModule;\r\n+    SHGetSpecialFolderPathWFn pSHGetSpecialFolderPathW;\r\n+    PRUnichar szSysDir[_MAX_PATH];\r\n+    static const int folders[] = {\r\n+        CSIDL_BITBUCKET,  \r\n+        CSIDL_RECENT,\r\n+#ifndef WINCE     \r\n+        CSIDL_INTERNET_CACHE, \r\n+        CSIDL_HISTORY,\r\n+#endif\r\n+        0\r\n+    };\r\n+    int i = 0;\r\n+    if (_MAX_PATH > (i = GetTempPathW(_MAX_PATH, szSysDir))) {\r\n+        if (i > 0 && szSysDir[i-1] == L'\\\\')\r\n+            szSysDir[i-1] = L'\\0'; // we need to lop off the trailing slash\r\n+        EnumSystemFilesInFolder(func, szSysDir, MAX_DEPTH);\r\n+    }\r\n+    hModule = LoadLibrary(\"shell32.dll\");\r\n+    if (hModule != NULL) {\r\n+      pSHGetSpecialFolderPathW = (SHGetSpecialFolderPathWFn)\r\n+        GetProcAddress(hModule, \"SHGetSpecialFolderPathW\");\r\n+      if (pSHGetSpecialFolderPathW) {\r\n+        for(i = 0; folders[i]; i++) {\r\n+            DWORD rv = pSHGetSpecialFolderPathW(NULL, szSysDir, folders[i], 0);\r\n+            if (szSysDir[0])\r\n+                EnumSystemFilesInFolder(func, szSysDir, MAX_DEPTH);\r\n+            szSysDir[0] =  L'\\0';\r\n+        }\r\n+      }\r\n+      FreeLibrary(hModule);\r\n+    }\r\n+    return PR_TRUE;\r\n+}\r\n \r\n static PRInt32\r\n CountFiles(const PRUnichar *file)\r\n\r\n```"}}
{"actor":{"display_login":"rn10950"}}