Skip to content

Commit

Permalink
Fix FindFirstFileA failing due to an empty parent and add locale `L…
Browse files Browse the repository at this point in the history
…CType` stubs (#71)

* Fix sn cpp.exe not finding the include paths

* str_for_LCType stubs for sn gcc as.exe
  • Loading branch information
AngheloAlf authored Mar 23, 2024
1 parent 6d284d4 commit 0fbe877
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions dll/kernel32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,15 +724,20 @@ namespace kernel32 {
return (void *) 1;
}

auto *handle = new FindFirstFileHandle();
// If the parent path is empty then we assume the parent path is the current directory.
auto parent_path = path.parent_path();
if (parent_path == "") {
parent_path = ".";
}

if (!std::filesystem::exists(path.parent_path())) {
if (!std::filesystem::exists(parent_path)) {
wibo::lastError = ERROR_PATH_NOT_FOUND;
delete handle;
return INVALID_HANDLE_VALUE;
}

std::filesystem::directory_iterator it(path.parent_path());
auto *handle = new FindFirstFileHandle();

std::filesystem::directory_iterator it(parent_path);
handle->it = it;
handle->pattern = path.filename().string();

Expand Down Expand Up @@ -1912,7 +1917,39 @@ namespace kernel32 {
if (LCType == 4098) { // LOCALE_SENGCOUNTRY
return "Country";
}
assert(false);
if (LCType == 0x1) { // LOCALE_ILANGUAGE
return "0001";
}
if (LCType == 0x15) { // LOCALE_SINTLSYMBOL
return "Currency";
}
if (LCType == 0x14) { // LOCALE_SCURRENCY
return "sCurrency";
}
if (LCType == 0x16) { // LOCALE_SMONDECIMALSEP
return ".";
}
if (LCType == 0x17) { // LOCALE_SMONTHOUSANDSEP
return ",";
}
if (LCType == 0x18) { // LOCALE_SMONGROUPING
return ";";
}
if (LCType == 0x50) { // LOCALE_SPOSITIVESIGN
return "";
}
if (LCType == 0x51) { // LOCALE_SNEGATIVESIGN
return "-";
}
if (LCType == 0x1A) { // LOCALE_IINTLCURRDIGITS
return "2";
}
if (LCType == 0x19) { // LOCALE_ICURRDIGITS
return "2";
}

DEBUG_LOG("STUB: LCType 0x%X not implemented\n", LCType);
return "";
}

int WIN_FUNC GetLocaleInfoA(unsigned int Locale, int LCType, LPSTR lpLCData, int cchData) {
Expand Down

0 comments on commit 0fbe877

Please sign in to comment.