comparison dynload/dynload_windows.c @ 310:2e8be88dad11

- comment cleanup
author Tassilo Philipp
date Fri, 25 Oct 2019 00:32:29 +0200
parents 7c6f19d42b31
children 655cafde0859
comparison
equal deleted inserted replaced
309:b51401bc4c37 310:2e8be88dad11
58 if(!ws) 58 if(!ws)
59 return NULL; 59 return NULL;
60 60
61 /* ... convert (and use r as success flag), ... */ 61 /* ... convert (and use r as success flag), ... */
62 r = (MultiByteToWideChar(CP_UTF8, 0, libPath, -1, ws, r) == r); 62 r = (MultiByteToWideChar(CP_UTF8, 0, libPath, -1, ws, r) == r);
63 pLib = (DLLib*)(r ? LoadLibraryW(ws) : NULL);/*@@@ testcode of unicode path*/ 63 pLib = (DLLib*)(r ? LoadLibraryW(ws) : NULL);
64 64
65 /* ... free temp space and return handle */ 65 /* ... free temp space and return handle */
66 dlFreeMem(ws); 66 dlFreeMem(ws);
67 return pLib; 67 return pLib;
68 } 68 }
93 /* of 2s for loop to be precise and to test allow testing up to 32768 chars */ 93 /* of 2s for loop to be precise and to test allow testing up to 32768 chars */
94 /* (including \0), which is the extended path ("\\?\...") maximum */ 94 /* (including \0), which is the extended path ("\\?\...") maximum */
95 static const int MAX_EXT_PATH = 1<<15; /* max extended path length (32768) */ 95 static const int MAX_EXT_PATH = 1<<15; /* max extended path length (32768) */
96 int nc = 1<<6; /* guess start buffer size, */ 96 int nc = 1<<6; /* guess start buffer size, */
97 97
98 while(nc <= MAX_EXT_PATH)/*@@@ testcode*/ 98 while(nc <= MAX_EXT_PATH)/*@@@ add testcode for super long paths*/
99 { 99 {
100 ws = (wchar_t*)dlAllocMem(nc * sizeof(wchar_t)); 100 ws = (wchar_t*)dlAllocMem(nc * sizeof(wchar_t));
101 if(!ws) 101 if(!ws)
102 break; 102 break;
103 103
104 r = GetModuleFileNameW((HMODULE)pLib, ws, nc); 104 r = GetModuleFileNameW((HMODULE)pLib, ws, nc);
105 105
106 /* r == nc if string was truncated, double temp buffer size */ 106 /* r == nc if string was truncated, double temp buffer size */
107 if(r == nc) { 107 if(r == nc) {
108 nc <<= 1;/*@@@ testcode*/ 108 nc <<= 1;
109 dlFreeMem(ws); 109 dlFreeMem(ws);
110 continue; 110 continue;
111 } 111 }
112 /* error if r is 0 */ 112 /* error if r is 0 */
113 else if(!r) { 113 else if(!r) {