mirror of
https://github.com/vxunderground/VX-API
synced 2024-06-29 18:21:18 +00:00
Create CfCreateLocalAppDataObjectPath.cpp
This commit is contained in:
parent
6793b8ad08
commit
c9a90cbf80
46
Windows API/CfCreateLocalAppDataObjectPath.cpp
Normal file
46
Windows API/CfCreateLocalAppDataObjectPath.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
pBuffer == OUT
|
||||||
|
Path == concatted, must have \\ in front i.e. L"\\File.exe"
|
||||||
|
|
||||||
|
Credit: smelly__vx
|
||||||
|
*/
|
||||||
|
BOOL CfCreateLocalAppDataObjectPathW(PWCHAR pBuffer, PWCHAR Path, DWORD Size, BOOL bDoesObjectExist)
|
||||||
|
{
|
||||||
|
if (pBuffer == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (RfGetEnvironmentVariableW(L"LOCALAPPDATA", pBuffer, Size) == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (StringConcatW(pBuffer, Path) == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (bDoesObjectExist)
|
||||||
|
{
|
||||||
|
if (!IsPathValidW(pBuffer))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CfCreateLocalAppDataObjectPathA(PCHAR pBuffer, PCHAR Path, DWORD Size, BOOL bDoesObjectExist)
|
||||||
|
{
|
||||||
|
if (pBuffer == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (RfGetEnvironmentVariableA("LOCALAPPDATA", pBuffer, Size) == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (StringConcatA(pBuffer, Path) == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (bDoesObjectExist)
|
||||||
|
{
|
||||||
|
if (!IsPathValidA(pBuffer))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user