Add files via upload

This commit is contained in:
vxunderground 2021-05-28 14:35:13 -05:00 committed by GitHub
parent b70f3497de
commit 5751be5552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,34 @@
#include <windows.h>
SIZE_T StringLengthW(LPCWSTR String)
{
LPCWSTR String2;
for (String2 = String; *String2; ++String2);
return (String2 - String);
}
SIZE_T WCharStringToCharString(PCHAR Destination, PWCHAR Source, SIZE_T MaximumAllowed)
{
INT Length = MaximumAllowed;
while (--Length >= 0)
{
if (!(*Destination++ = *Source++))
return MaximumAllowed - Length - 1;
}
return MaximumAllowed - Length;
}
INT main(VOID)
{
CHAR Path[MAX_PATH] = { 0 };
WCHAR CharPath[MAX_PATH * sizeof(WCHAR)] = L"\\Users\\Tmp\\Desktop\\";
if(WCharStringToCharString(&Path, CharPath, StringLengthW(CharPath)) == 0)
return 1;
return ERROR_SUCCESS;
}