Skip to content

Commit 39aa864

Browse files
authored
Maintenance: Fix compiler error C2362 in creatwth.cpp
Compile error: error C2362: initialization of 'cchWrittenWideChar' is skipped by 'goto Cleanup'
1 parent 90f54c2 commit 39aa864

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/creatwth.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,8 @@ BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
12801280
WCHAR szCommand[MAX_PATH];
12811281
PDETOUR_EXE_HELPER helper = NULL;
12821282
HRESULT hr;
1283+
WCHAR szDllName[MAX_PATH];
1284+
int cchWrittenWideChar;
12831285
DWORD nLen = GetEnvironmentVariableW(L"WINDIR", szExe, ARRAYSIZE(szExe));
12841286

12851287
DETOUR_TRACE(("DetourProcessViaHelperDlls(pid=%d,dlls=%d)\n", dwTargetPid, nDlls));
@@ -1310,8 +1312,8 @@ BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
13101312

13111313
//for East Asia languages and so on, like Chinese, print format with "%hs" can not work fine before user call _tsetlocale(LC_ALL,_T(".ACP"));
13121314
//so we can't use "%hs" in format string, because the dll that contain this code would inject to any process, even not call _tsetlocale(LC_ALL,_T(".ACP")) before
1313-
WCHAR szDllName[MAX_PATH];
1314-
int cchWrittenWideChar = MultiByteToWideChar(CP_ACP, 0, &helper->rDlls[0], -1, szDllName, ARRAYSIZE(szDllName));
1315+
1316+
cchWrittenWideChar = MultiByteToWideChar(CP_ACP, 0, &helper->rDlls[0], -1, szDllName, ARRAYSIZE(szDllName));
13151317
if (cchWrittenWideChar >= ARRAYSIZE(szDllName) || cchWrittenWideChar <= 0) {
13161318
goto Cleanup;
13171319
}

0 commit comments

Comments
 (0)