+ GetLastError();
+ FormatMessageA(0, 0, 0, 0, 0, 0, 0);
+ #ifdef LISP_FEATURE_SB_UNICODE
+ FormatMessageW(0, 0, 0, 0, 0, 0, 0);
+ #endif
+ _get_osfhandle(0);
+ ReadFile(0, 0, 0, 0, 0);
+ WriteFile(0, 0, 0, 0, 0);
+ PeekNamedPipe(0, 0, 0, 0, 0, 0);
+ FlushConsoleInputBuffer(0);
+ PeekConsoleInput(0, 0, 0, 0);
+ Sleep(0);
+ #ifndef LISP_FEATURE_SB_UNICODE
+ SHGetFolderPathA(0, 0, 0, 0, 0);
+ #else
+ SHGetFolderPathW(0, 0, 0, 0, 0);
+ #endif
+ GetACP();
+ GetOEMCP();
+ LocalFree(0);
+ #ifndef LISP_FEATURE_SB_UNICODE
+ GetEnvironmentVariableA(0,0,0);
+ #else
+ GetEnvironmentVariableW(0,0,0);
+ #endif
+ GetConsoleCP();
+ GetConsoleOutputCP();
+}
+
+char *
+os_get_runtime_executable_path()
+{
+ char path[MAX_PATH + 1];
+ DWORD bufsize = sizeof(path);
+ DWORD size;
+
+ if ((size = GetModuleFileNameA(NULL, path, bufsize)) == 0)
+ return NULL;
+ else if (size == bufsize && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ return NULL;
+
+ return copied_string(path);