Fix over again.
This commit is contained in:
parent
eb9d4f2b1a
commit
dd21b8cb1f
|
@ -323,7 +323,91 @@ _FX BOOL Gui_StretchBlt(
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
HBITMAP bmp = NULL;
|
_FX void Gdi_SplWow64(BOOLEAN Register)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// see GuiServer::SplWow64Slave
|
||||||
|
//
|
||||||
|
|
||||||
|
// NoSbieDesk BEGIN
|
||||||
|
if (Dll_CompartmentMode || SbieApi_QueryConfBool(NULL, L"NoSandboxieDesktop", FALSE))
|
||||||
|
return;
|
||||||
|
// NoSbieDesk END
|
||||||
|
|
||||||
|
GUI_SPLWOW64_REQ req;
|
||||||
|
void* rpl;
|
||||||
|
|
||||||
|
if (Register) {
|
||||||
|
|
||||||
|
if (Ldr_BoxedImage || _wcsicmp(Dll_ImageName, L"splwow64.exe") != 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
req.msgid = GUI_SPLWOW64;
|
||||||
|
req.set = Register;
|
||||||
|
req.win8 = (Dll_OsBuild >= 8400) ? TRUE : FALSE;
|
||||||
|
rpl = Gui_CallProxy(&req, sizeof(req), sizeof(ULONG));
|
||||||
|
if (rpl)
|
||||||
|
Dll_Free(rpl);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Gdi_CreateDCW
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _WIN64
|
||||||
|
|
||||||
|
_FX HDC Gdi_CreateDCW2(
|
||||||
|
void* lpszDriver, void* lpszDevice, void* lpszOutput, void* lpInitData)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// on 64-bit Windows 8, some 32-bit programs (Notepad, Chrome) cannot
|
||||||
|
// create a printer DC (via WINSPOOL) if an instance of SplWow64.exe
|
||||||
|
// has been terminated, since the last time that 32-bit process has
|
||||||
|
// connected to SplWow64.exe. the reason for this is not clear, but
|
||||||
|
// it seems a possible workaround is to try recreating the DC several
|
||||||
|
// times, until the CreateDC call finally works.
|
||||||
|
//
|
||||||
|
|
||||||
|
HDC hdc = __sys_CreateDCW(
|
||||||
|
lpszDriver, lpszDevice, lpszOutput, lpInitData);
|
||||||
|
|
||||||
|
if ((!hdc) && lpszDriver && _wcsicmp(lpszDriver, L"WINSPOOL") == 0) {
|
||||||
|
|
||||||
|
P_DocumentProperties __sys_DocumentProperties =
|
||||||
|
Ldr_GetProcAddrNew(L"winspool.drv", L"DocumentPropertiesW", "DocumentPropertiesW");
|
||||||
|
|
||||||
|
ULONG retry = 0;
|
||||||
|
|
||||||
|
while (__sys_DocumentProperties && (!hdc) && (retry < 20)) {
|
||||||
|
|
||||||
|
HANDLE hPrinter;
|
||||||
|
|
||||||
|
Sleep(retry * 25);
|
||||||
|
|
||||||
|
if (!__sys_OpenPrinter2W(lpInitData, &hPrinter, NULL, NULL))
|
||||||
|
break;
|
||||||
|
|
||||||
|
__sys_DocumentProperties(
|
||||||
|
NULL, hPrinter, lpInitData, NULL, NULL, 0);
|
||||||
|
|
||||||
|
hdc = __sys_CreateDCW(
|
||||||
|
lpszDriver, lpszDevice, lpszOutput, lpInitData);
|
||||||
|
|
||||||
|
__sys_ClosePrinter(hPrinter);
|
||||||
|
|
||||||
|
retry++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif ! _WIN64
|
||||||
|
HBITMAP bmp2 = NULL;
|
||||||
_FX HDC Gui_CreateDCA(LPCSTR pwszDriver, LPCSTR pwszDevice, LPCSTR pszPort, const void* pdm) {
|
_FX HDC Gui_CreateDCA(LPCSTR pwszDriver, LPCSTR pwszDevice, LPCSTR pszPort, const void* pdm) {
|
||||||
HDC ret = __sys_CreateDCA(pwszDriver, pwszDevice, pszPort, pdm);
|
HDC ret = __sys_CreateDCA(pwszDriver, pwszDevice, pszPort, pdm);
|
||||||
|
|
||||||
|
@ -341,9 +425,9 @@ _FX HDC Gui_CreateDCA(LPCSTR pwszDriver, LPCSTR pwszDevice, LPCSTR pszPort, co
|
||||||
iWidth = GetDeviceCaps(ret, HORZRES);
|
iWidth = GetDeviceCaps(ret, HORZRES);
|
||||||
iHeight = GetDeviceCaps(ret, VERTRES);
|
iHeight = GetDeviceCaps(ret, VERTRES);
|
||||||
HBITMAP hBmp;
|
HBITMAP hBmp;
|
||||||
if (bmp == NULL)
|
if (bmp2 == NULL)
|
||||||
bmp = CreateCompatibleBitmap(ret2, iWidth, iHeight);
|
bmp2 = CreateCompatibleBitmap(ret2, iWidth, iHeight);
|
||||||
hBmp = bmp;
|
hBmp = bmp2;
|
||||||
SelectObject(ret2, hBmp);
|
SelectObject(ret2, hBmp);
|
||||||
DeleteDC(ret);
|
DeleteDC(ret);
|
||||||
ret = ret2;
|
ret = ret2;
|
||||||
|
@ -375,9 +459,9 @@ _FX HDC Gui_CreateDCW(LPCWSTR pwszDriver, LPCWSTR pwszDevice, LPCWSTR pszPort,
|
||||||
iWidth = GetDeviceCaps(ret, HORZRES);
|
iWidth = GetDeviceCaps(ret, HORZRES);
|
||||||
iHeight = GetDeviceCaps(ret, VERTRES);
|
iHeight = GetDeviceCaps(ret, VERTRES);
|
||||||
HBITMAP hBmp;
|
HBITMAP hBmp;
|
||||||
if (bmp == NULL)
|
if (bmp2 == NULL)
|
||||||
bmp = CreateCompatibleBitmap(ret2, iWidth, iHeight);
|
bmp2 = CreateCompatibleBitmap(ret2, iWidth, iHeight);
|
||||||
hBmp = bmp;
|
hBmp = bmp2;
|
||||||
SelectObject(ret2, hBmp);
|
SelectObject(ret2, hBmp);
|
||||||
DeleteDC(ret);
|
DeleteDC(ret);
|
||||||
ret = ret2;
|
ret = ret2;
|
||||||
|
@ -391,90 +475,7 @@ _FX HDC Gui_CreateDCW(LPCWSTR pwszDriver, LPCWSTR pwszDevice, LPCWSTR pszPort,
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
_FX void Gdi_SplWow64(BOOLEAN Register)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// see GuiServer::SplWow64Slave
|
|
||||||
//
|
|
||||||
|
|
||||||
// NoSbieDesk BEGIN
|
|
||||||
if (Dll_CompartmentMode || SbieApi_QueryConfBool(NULL, L"NoSandboxieDesktop", FALSE))
|
|
||||||
return;
|
|
||||||
// NoSbieDesk END
|
|
||||||
|
|
||||||
GUI_SPLWOW64_REQ req;
|
|
||||||
void *rpl;
|
|
||||||
|
|
||||||
if (Register) {
|
|
||||||
|
|
||||||
if (Ldr_BoxedImage || _wcsicmp(Dll_ImageName, L"splwow64.exe") != 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
req.msgid = GUI_SPLWOW64;
|
|
||||||
req.set = Register;
|
|
||||||
req.win8 = (Dll_OsBuild >= 8400) ? TRUE : FALSE;
|
|
||||||
rpl = Gui_CallProxy(&req, sizeof(req), sizeof(ULONG));
|
|
||||||
if (rpl)
|
|
||||||
Dll_Free(rpl);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// Gdi_CreateDCW
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIN64
|
|
||||||
|
|
||||||
_FX HDC Gdi_CreateDCW2(
|
|
||||||
void *lpszDriver, void *lpszDevice, void *lpszOutput, void *lpInitData)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// on 64-bit Windows 8, some 32-bit programs (Notepad, Chrome) cannot
|
|
||||||
// create a printer DC (via WINSPOOL) if an instance of SplWow64.exe
|
|
||||||
// has been terminated, since the last time that 32-bit process has
|
|
||||||
// connected to SplWow64.exe. the reason for this is not clear, but
|
|
||||||
// it seems a possible workaround is to try recreating the DC several
|
|
||||||
// times, until the CreateDC call finally works.
|
|
||||||
//
|
|
||||||
|
|
||||||
HDC hdc = __sys_CreateDCW(
|
|
||||||
lpszDriver, lpszDevice, lpszOutput, lpInitData);
|
|
||||||
|
|
||||||
if ((! hdc) && lpszDriver && _wcsicmp(lpszDriver, L"WINSPOOL") == 0) {
|
|
||||||
|
|
||||||
P_DocumentProperties __sys_DocumentProperties =
|
|
||||||
Ldr_GetProcAddrNew(L"winspool.drv", L"DocumentPropertiesW","DocumentPropertiesW");
|
|
||||||
|
|
||||||
ULONG retry = 0;
|
|
||||||
|
|
||||||
while (__sys_DocumentProperties && (! hdc) && (retry < 20)) {
|
|
||||||
|
|
||||||
HANDLE hPrinter;
|
|
||||||
|
|
||||||
Sleep(retry * 25);
|
|
||||||
|
|
||||||
if (! __sys_OpenPrinter2W(lpInitData, &hPrinter, NULL, NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
__sys_DocumentProperties(
|
|
||||||
NULL, hPrinter, lpInitData, NULL, NULL, 0);
|
|
||||||
|
|
||||||
hdc = __sys_CreateDCW(
|
|
||||||
lpszDriver, lpszDevice, lpszOutput, lpInitData);
|
|
||||||
|
|
||||||
__sys_ClosePrinter(hPrinter);
|
|
||||||
|
|
||||||
retry++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif ! _WIN64
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue