[wue] allow the provision of an arbitrary local account username

* This is required because, even though it's easy to change a local account name
  post install, doing so does not change the directory name in C:\Users\
This commit is contained in:
Pete Batard 2022-10-18 13:58:38 +01:00
parent cee21b1981
commit c19ef1125d
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
10 changed files with 151 additions and 105 deletions

View file

@ -345,6 +345,8 @@ static __inline int GetWindowTextU(HWND hWnd, char* lpString, int nMaxCount)
{
int ret = 0;
DWORD err = ERROR_INVALID_DATA;
if (nMaxCount < 0)
return 0;
// Handle the empty string as GetWindowTextW() returns 0 then
if ((lpString != NULL) && (nMaxCount > 0))
lpString[0] = 0;
@ -357,6 +359,7 @@ static __inline int GetWindowTextU(HWND hWnd, char* lpString, int nMaxCount)
err = GetLastError();
}
wfree(lpString);
lpString[nMaxCount - 1] = 0;
SetLastError(err);
return ret;
}