[*] tism
This commit is contained in:
parent
f177b67e1f
commit
fe8ef28930
@ -313,48 +313,32 @@ namespace Aurora
|
|||||||
attrs.nLength = sizeof(attrs);
|
attrs.nLength = sizeof(attrs);
|
||||||
attrs.bInheritHandle = bInherit ? TRUE : FALSE;
|
attrs.bInheritHandle = bInherit ? TRUE : FALSE;
|
||||||
|
|
||||||
if ((dwFlags & 0x4ffff7) &&
|
bool bSpecialFlags = (dwFlags & 0x4ffff7);
|
||||||
(!pCreateFile2))
|
bool bSpecialAttrs = (dwAttributes & 0xFFB00008);
|
||||||
|
|
||||||
|
if (!pCreateFile2)
|
||||||
{
|
{
|
||||||
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
|
if (bSpecialFlags)
|
||||||
return INVALID_HANDLE_VALUE;
|
{
|
||||||
|
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bSpecialAttrs)
|
||||||
|
{
|
||||||
|
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dwAttributes & 0xFFB00008) &&
|
|
||||||
(!pCreateFile2))
|
|
||||||
{
|
|
||||||
SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open");
|
|
||||||
return INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dwAttributes)
|
if (!dwAttributes)
|
||||||
{
|
{
|
||||||
dwAttributes = FILE_ATTRIBUTE_NORMAL;
|
dwAttributes = FILE_ATTRIBUTE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCreateFile2)
|
if (pCreateFileW &&
|
||||||
{
|
!bSpecialFlags &&
|
||||||
_CREATEFILE2_EXTENDED_PARAMETERS params {};
|
!bSpecialAttrs)
|
||||||
|
|
||||||
if (::wcscmp(lpFileName, L"CONIN$") == 0 ||
|
|
||||||
::wcscmp(lpFileName, L"CONOUT$") == 0 ||
|
|
||||||
::wcscmp(lpFileName, L"CONERR$") == 0)
|
|
||||||
{
|
|
||||||
lpFileName = L"CON";
|
|
||||||
}
|
|
||||||
|
|
||||||
params.dwSize = sizeof(_CREATEFILE2_EXTENDED_PARAMETERS);
|
|
||||||
params.dwFileFlags = dwFlags;
|
|
||||||
params.dwFileAttributes = dwAttributes;
|
|
||||||
params.lpSecurityAttributes = &attrs;
|
|
||||||
|
|
||||||
return pCreateFile2(lpFileName,
|
|
||||||
dwDesiredAccess,
|
|
||||||
dwShareMode,
|
|
||||||
dwCreationDisposition,
|
|
||||||
¶ms);
|
|
||||||
}
|
|
||||||
else if (pCreateFileW)
|
|
||||||
{
|
{
|
||||||
return pCreateFileW(lpFileName,
|
return pCreateFileW(lpFileName,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
@ -364,9 +348,50 @@ namespace Aurora
|
|||||||
dwFlags | dwAttributes,
|
dwFlags | dwAttributes,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (pCreateFile2)
|
||||||
{
|
{
|
||||||
return INVALID_HANDLE_VALUE;
|
_CREATEFILE2_EXTENDED_PARAMETERS params {};
|
||||||
|
bool bWrite {};
|
||||||
|
HANDLE hHandle {};
|
||||||
|
|
||||||
|
params.dwSize = sizeof(_CREATEFILE2_EXTENDED_PARAMETERS);
|
||||||
|
params.dwFileFlags = dwFlags;
|
||||||
|
params.dwFileAttributes = dwAttributes;
|
||||||
|
params.lpSecurityAttributes = &attrs;
|
||||||
|
|
||||||
|
if ((bWrite = (::wcscmp(lpFileName, L"CONIN$") == 0))||
|
||||||
|
::wcscmp(lpFileName, L"CONOUT$") == 0 ||
|
||||||
|
::wcscmp(lpFileName, L"CONERR$") == 0)
|
||||||
|
{
|
||||||
|
if (bWrite)
|
||||||
|
{
|
||||||
|
dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dwDesiredAccess = GENERIC_READ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((hHandle = pCreateFile2(lpFileName,
|
||||||
|
dwDesiredAccess,
|
||||||
|
dwShareMode,
|
||||||
|
dwCreationDisposition,
|
||||||
|
¶ms)) != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
return hHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
lpFileName = L"CON";
|
||||||
|
}
|
||||||
|
|
||||||
|
return pCreateFile2(lpFileName,
|
||||||
|
dwDesiredAccess,
|
||||||
|
dwShareMode,
|
||||||
|
dwCreationDisposition,
|
||||||
|
¶ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -51,11 +51,10 @@ namespace Aurora::IO
|
|||||||
#if defined(AURORA_PLATFORM_WIN32)
|
#if defined(AURORA_PLATFORM_WIN32)
|
||||||
GetStdHandle(STD_INPUT_HANDLE);
|
GetStdHandle(STD_INPUT_HANDLE);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
Win32Open(L"CONIN$",
|
Win32Open(L"CONIN$",
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
false,
|
bSharing,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
@ -79,7 +78,7 @@ namespace Aurora::IO
|
|||||||
Win32Open(bError ? L"CONERR$" : L"CONOUT$",
|
Win32Open(bError ? L"CONERR$" : L"CONOUT$",
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
false,
|
bSharing,
|
||||||
OPEN_EXISTING,
|
OPEN_EXISTING,
|
||||||
0,
|
0,
|
||||||
0);
|
0);
|
||||||
|
Loading…
Reference in New Issue
Block a user