@@ -119,6 +119,7 @@ namespace kernel32 {
119
119
}
120
120
121
121
uint32_t WIN_FUNC GetLastError () {
122
+ DEBUG_LOG (" GetLastError() -> %u\n " , wibo::lastError);
122
123
return wibo::lastError;
123
124
}
124
125
@@ -276,6 +277,7 @@ namespace kernel32 {
276
277
}
277
278
278
279
int WIN_FUNC GetSystemDefaultLangID () {
280
+ DEBUG_LOG (" STUB GetSystemDefaultLangID\n " );
279
281
return 0 ;
280
282
}
281
283
@@ -680,6 +682,13 @@ namespace kernel32 {
680
682
};
681
683
682
684
bool findNextFile (FindFirstFileHandle *handle) {
685
+ if ((handle->it != std::filesystem::directory_iterator ()) && (handle->pattern == " " )) {
686
+ // The caller (ie `FindFirstFileA`) was passed a path with a
687
+ // trailing period (like `include/.`). This behavior doesn't seem
688
+ // to be documented, so we treat it as an "find any file on this
689
+ // directory".
690
+ return true ;
691
+ }
683
692
while (handle->it != std::filesystem::directory_iterator ()) {
684
693
std::filesystem::path path = *handle->it ;
685
694
if (fnmatch (handle->pattern .c_str (), path.filename ().c_str (), 0 ) == 0 ) {
@@ -774,6 +783,7 @@ namespace kernel32 {
774
783
}
775
784
776
785
int WIN_FUNC FindNextFileA (void *hFindFile, WIN32_FIND_DATA<char > *lpFindFileData) {
786
+ DEBUG_LOG (" FindNextFileA(%p, %p)\n " , hFindFile, lpFindFileData);
777
787
// Special value from FindFirstFileA
778
788
if (hFindFile == (void *) 1 ) {
779
789
wibo::lastError = ERROR_NO_MORE_FILES;
@@ -1279,7 +1289,7 @@ namespace kernel32 {
1279
1289
}
1280
1290
1281
1291
unsigned int WIN_FUNC SetConsoleCtrlHandler (void *HandlerRoutine, unsigned int Add) {
1282
- DEBUG_LOG (" SetConsoleCtrlHandler\n " );
1292
+ DEBUG_LOG (" STUB SetConsoleCtrlHandler\n " );
1283
1293
// This is a function that gets called when doing ^C
1284
1294
// We might want to call this later (being mindful that it'll be stdcall I think)
1285
1295
@@ -1302,6 +1312,7 @@ namespace kernel32 {
1302
1312
};
1303
1313
1304
1314
unsigned int WIN_FUNC GetConsoleScreenBufferInfo (void *hConsoleOutput, CONSOLE_SCREEN_BUFFER_INFO *lpConsoleScreenBufferInfo) {
1315
+ DEBUG_LOG (" GetConsoleScreenBufferInfo(%p, %p)\n " , hConsoleOutput, lpConsoleScreenBufferInfo);
1305
1316
// Tell a lie
1306
1317
// mwcc doesn't care about anything else
1307
1318
lpConsoleScreenBufferInfo->dwSize_x = 80 ;
@@ -1368,17 +1379,19 @@ namespace kernel32 {
1368
1379
}
1369
1380
1370
1381
unsigned int WIN_FUNC GetCurrentDirectoryA (unsigned int uSize, char *lpBuffer) {
1371
- DEBUG_LOG (" GetCurrentDirectoryA(%u, %p)\n " , uSize, lpBuffer);
1382
+ DEBUG_LOG (" GetCurrentDirectoryA(%u, %p)" , uSize, lpBuffer);
1372
1383
1373
1384
std::filesystem::path cwd = std::filesystem::current_path ();
1374
1385
std::string path = files::pathToWindows (cwd);
1375
1386
1376
1387
// If the buffer is too small, return the required buffer size.
1377
1388
// (Add 1 to include the NUL terminator)
1378
1389
if (path.size () + 1 > uSize) {
1390
+ DEBUG_LOG (" !! Buffer too small: %i, %i\n " , path.size () + 1 , uSize);
1379
1391
return path.size () + 1 ;
1380
1392
}
1381
1393
1394
+ DEBUG_LOG (" -> %s\n " , path.c_str ());
1382
1395
strcpy (lpBuffer, path.c_str ());
1383
1396
return path.size ();
1384
1397
}
@@ -1786,6 +1799,7 @@ namespace kernel32 {
1786
1799
return 1 ;
1787
1800
1788
1801
// sure.. we have that feature...
1802
+ DEBUG_LOG (" IsProcessorFeaturePresent: we don't know about feature %u, lying...\n " , processorFeature);
1789
1803
return 1 ;
1790
1804
}
1791
1805
0 commit comments