forked from Dniel97/segatools
hooklib/path.c: hook Ex variants of CreateDirectory
This commit is contained in:
parent
bd1e893b7a
commit
eef0f74ac0
@ -27,6 +27,16 @@ static BOOL WINAPI hook_CreateDirectoryW(
|
|||||||
const wchar_t *lpFileName,
|
const wchar_t *lpFileName,
|
||||||
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
||||||
|
|
||||||
|
static BOOL WINAPI hook_CreateDirectoryExA(
|
||||||
|
const char *lpTemplateDirectory,
|
||||||
|
const char *lpNewDirectory,
|
||||||
|
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
||||||
|
|
||||||
|
static BOOL WINAPI hook_CreateDirectoryExW(
|
||||||
|
const wchar_t *lpTemplateDirectory,
|
||||||
|
const wchar_t *lpNewDirectory,
|
||||||
|
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
||||||
|
|
||||||
static HANDLE WINAPI hook_CreateFileA(
|
static HANDLE WINAPI hook_CreateFileA(
|
||||||
const char *lpFileName,
|
const char *lpFileName,
|
||||||
uint32_t dwDesiredAccess,
|
uint32_t dwDesiredAccess,
|
||||||
@ -93,6 +103,16 @@ static BOOL (WINAPI *next_CreateDirectoryW)(
|
|||||||
const wchar_t *lpFileName,
|
const wchar_t *lpFileName,
|
||||||
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
||||||
|
|
||||||
|
static BOOL (WINAPI *next_CreateDirectoryExA)(
|
||||||
|
const char *lpTemplateDirectory,
|
||||||
|
const char *lpNewDirectory,
|
||||||
|
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
||||||
|
|
||||||
|
static BOOL (WINAPI *next_CreateDirectoryExW)(
|
||||||
|
const wchar_t *lpTemplateDirectory,
|
||||||
|
const wchar_t *lpNewDirectory,
|
||||||
|
SECURITY_ATTRIBUTES *lpSecurityAttributes);
|
||||||
|
|
||||||
static HANDLE (WINAPI *next_CreateFileA)(
|
static HANDLE (WINAPI *next_CreateFileA)(
|
||||||
const char *lpFileName,
|
const char *lpFileName,
|
||||||
uint32_t dwDesiredAccess,
|
uint32_t dwDesiredAccess,
|
||||||
@ -160,6 +180,14 @@ static const struct hook_symbol path_hook_syms[] = {
|
|||||||
.name = "CreateDirectoryW",
|
.name = "CreateDirectoryW",
|
||||||
.patch = hook_CreateDirectoryW,
|
.patch = hook_CreateDirectoryW,
|
||||||
.link = (void **) &next_CreateDirectoryW,
|
.link = (void **) &next_CreateDirectoryW,
|
||||||
|
}, {
|
||||||
|
.name = "CreateDirectoryExA",
|
||||||
|
.patch = hook_CreateDirectoryExA,
|
||||||
|
.link = (void **) &next_CreateDirectoryExA,
|
||||||
|
}, {
|
||||||
|
.name = "CreateDirectoryExW",
|
||||||
|
.patch = hook_CreateDirectoryExW,
|
||||||
|
.link = (void **) &next_CreateDirectoryExW,
|
||||||
}, {
|
}, {
|
||||||
.name = "CreateFileA",
|
.name = "CreateFileA",
|
||||||
.patch = hook_CreateFileA,
|
.patch = hook_CreateFileA,
|
||||||
@ -470,6 +498,54 @@ static BOOL WINAPI hook_CreateDirectoryW(
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL WINAPI hook_CreateDirectoryExA(
|
||||||
|
const char *lpTemplateDirectory,
|
||||||
|
const char *lpNewDirectory,
|
||||||
|
SECURITY_ATTRIBUTES *lpSecurityAttributes)
|
||||||
|
{
|
||||||
|
char *trans;
|
||||||
|
BOOL ok;
|
||||||
|
|
||||||
|
ok = path_transform_a(&trans, lpNewDirectory);
|
||||||
|
|
||||||
|
if (!ok) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ok = next_CreateDirectoryExA(
|
||||||
|
lpTemplateDirectory,
|
||||||
|
trans ? trans : lpNewDirectory,
|
||||||
|
lpSecurityAttributes);
|
||||||
|
|
||||||
|
free(trans);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL WINAPI hook_CreateDirectoryExW(
|
||||||
|
const wchar_t *lpTemplateDirectory,
|
||||||
|
const wchar_t *lpNewDirectory,
|
||||||
|
SECURITY_ATTRIBUTES *lpSecurityAttributes)
|
||||||
|
{
|
||||||
|
wchar_t *trans;
|
||||||
|
BOOL ok;
|
||||||
|
|
||||||
|
ok = path_transform_w(&trans, lpNewDirectory);
|
||||||
|
|
||||||
|
if (!ok) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ok = next_CreateDirectoryExW(
|
||||||
|
lpTemplateDirectory,
|
||||||
|
trans ? trans : lpNewDirectory,
|
||||||
|
lpSecurityAttributes);
|
||||||
|
|
||||||
|
free(trans);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't pull in the entire iohook framework just for CreateFileA/CreateFileW */
|
/* Don't pull in the entire iohook framework just for CreateFileA/CreateFileW */
|
||||||
|
|
||||||
static HANDLE WINAPI hook_CreateFileA(
|
static HANDLE WINAPI hook_CreateFileA(
|
||||||
|
Loading…
Reference in New Issue
Block a user