Changeset 802 in dev for branches/egtra/ab5.0/abdev/OldWindowsHelperImpl.cpp
- Timestamp:
- Feb 6, 2011, 10:07:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/egtra/ab5.0/abdev/OldWindowsHelperImpl.cpp
r801 r802 17 17 extern FARPROC alias__imp__InterlockedPushEntrySList; 18 18 extern FARPROC alias__imp__InterlockedPopEntrySList; 19 extern FARPROC alias__imp__GetModuleHandleW;20 extern FARPROC alias__imp__GetStartupInfoW;21 extern FARPROC alias__imp__GetEnvironmentStringsW;22 extern FARPROC alias__imp__FreeEnvironmentStringsW;23 19 extern void* TrapTableLast; 24 20 } // extern "C" … … 88 84 } 89 85 90 HMODULE WINAPI Alternative_GetModuleHandleW(LPCWSTR moduleName)91 {92 HMODULE ret = nullptr;93 auto size = std::wcslen(moduleName) + 1;94 auto mbsSize = size * 2;95 if (auto buffer = static_cast<LPSTR>(::HeapAlloc(::GetProcessHeap(), HEAP_ZERO_MEMORY, mbsSize)))96 {97 if (::WideCharToMultiByte(CP_ACP, 0, moduleName, static_cast<int>(size), buffer, static_cast<int>(mbsSize), nullptr, nullptr) > 0)98 {99 ret = ::GetModuleHandleA(buffer);100 }101 ::HeapFree(::GetProcessHeap(), 0, buffer);102 }103 return ret;104 }105 106 // CRT用に最小限の実装107 void WINAPI Alternative_GetStartupInfoW(LPSTARTUPINFOW psi)108 {109 STARTUPINFOA sia;110 ::GetStartupInfoA(&sia);111 112 *psi = STARTUPINFOW();113 psi->cb = sizeof *psi;114 if (sia.dwFlags & STARTF_USESHOWWINDOW)115 {116 psi->dwFlags = STARTF_USESHOWWINDOW;117 psi->wShowWindow = sia.wShowWindow;118 }119 }120 121 LPWCH WINAPI Alternative_GetEnvironmentStringsW()122 {123 static WCHAR c[2];124 return c;125 }126 127 BOOL WINAPI Alternative_FreeEnvironmentStringsW(LPWCH)128 {129 return TRUE;130 }131 132 86 #define FUNCTION_INIT(name) \ 133 87 if (auto f = ::GetProcAddress(GetKernelModule(), #name)) { \ … … 159 113 alias__imp__InterlockedPushEntrySList = ::GetProcAddress(GetKernelModule(), "InterlockedPushEntrySList"); 160 114 alias__imp__InterlockedPopEntrySList = ::GetProcAddress(GetKernelModule(), "InterlockedPopEntrySList"); 161 FUNCTION_INIT_9X(GetModuleHandleW);162 FUNCTION_INIT_9X(GetStartupInfoW);163 FUNCTION_INIT_9X(GetEnvironmentStringsW);164 FUNCTION_INIT_9X(FreeEnvironmentStringsW);165 115 166 116 ::VirtualProtect(&TrapTableFirst,
Note:
See TracChangeset
for help on using the changeset viewer.