MCPcopy Create free account
hub / github.com/bwapi/bwapi / _CreateWindowEx

Function _CreateWindowEx

bwapi/BWAPI/Source/Detours.cpp:189–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187//--------------------------------------------- CREATE WINDOW ------------------------------------------------
188bool detourCreateWindow = false;
189HWND WINAPI _CreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
190{
191 auto CreateWindowExProc = _CreateWindowExAOld ? _CreateWindowExAOld : &CreateWindowExA;
192
193 HWND hWndReturn = NULL;
194 if ( strcmp(lpClassName, "SWarClass") == 0 )
195 {
196 std::string newWindowName = lpWindowName;
197 if (gdwProcNum > 1)
198 newWindowName += " Instance " + std::to_string(gdwProcNum);
199
200 detourCreateWindow = true;
201 if ( switchToWMode )
202 {
203#ifndef SHADOW_BROODWAR
204 if (isCorrectVersion)
205 {
206 HackUtil::CallPatch(BW::BWDATA::DDrawInitCallPatch, &DDInit);
207 }
208#endif
209 hWndReturn = CreateWindowExProc(dwExStyle,
210 lpClassName,
211 newWindowName.c_str(),
212 dwStyle | WS_OVERLAPPEDWINDOW,
213 windowRect.left,
214 windowRect.top,
215 windowRect.right,
216 windowRect.bottom,
217 hWndParent,
218 hMenu,
219 hInstance,
220 lpParam);
221 ghMainWnd = hWndReturn;
222 SetWMode(windowRect.right, windowRect.bottom, true);
223 }
224 else
225 {
226 hWndReturn = CreateWindowExProc(dwExStyle, lpClassName, newWindowName.c_str(), dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
227 ghMainWnd = hWndReturn;
228 }
229 switchToWMode = false;
230 // Obtain/hack WndProc
231 wOriginalProc = (WNDPROC)GetWindowLong(hWndReturn, GWLP_WNDPROC);
232 SetWindowLong(ghMainWnd, GWLP_WNDPROC, (LONG)&WindowProc);
233 }
234 else
235 {
236 hWndReturn = CreateWindowExProc(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
237 }
238 return hWndReturn;
239}
240
241//----------------------------------------------- FILE HOOKS -------------------------------------------------
242HANDLE WINAPI _FindFirstFile(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)

Callers

nothing calls this directly

Calls 3

CallPatchFunction · 0.85
SetWModeFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected