aboutsummaryrefslogtreecommitdiff
path: root/src/SMemUtf8.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2025-07-03 09:27:16 +0200
committerLadislav Zezula <zezula@volny.cz>2025-07-03 09:27:16 +0200
commit486a7dd29f3bdf884d4be5588d9171daa5da1bae (patch)
tree95d9d099a84a3587412eecffd2485da99820916b /src/SMemUtf8.cpp
parentb41cda40f9c3fbdb802cf63e739425cd805eecaa (diff)
Replaced GetLastError with SErrGetLastError
Diffstat (limited to 'src/SMemUtf8.cpp')
-rw-r--r--src/SMemUtf8.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/SMemUtf8.cpp b/src/SMemUtf8.cpp
index abc16ee..b9d5e9d 100644
--- a/src/SMemUtf8.cpp
+++ b/src/SMemUtf8.cpp
@@ -551,3 +551,32 @@ DWORD WINAPI SMemFileNameToUTF8(
pOutLength[0] = nOutLength;
return dwErrCode;
}
+
+//-----------------------------------------------------------------------------
+// (Set/Get)LastError wrapper
+
+#ifndef STORMLIB_WINDOWS
+#ifndef STORMLIB_WIIU
+static thread_local DWORD dwLastError = ERROR_SUCCESS;
+#else
+static DWORD dwLastError = ERROR_SUCCESS;
+#endif
+#endif
+
+void SErrSetLastError(DWORD dwErrCode)
+{
+#ifdef STORMLIB_WINDOWS
+ SetLastError(dwErrCode);
+#else
+ dwLastError = dwErrCode;
+#endif
+}
+
+DWORD SErrGetLastError()
+{
+#ifdef STORMLIB_WINDOWS
+ return GetLastError();
+#else
+ return dwLastError;
+#endif
+}