Commit 23ab9d7e authored by Damien Fouilleul's avatar Damien Fouilleul

- minor fixes

parent ba98f2bd
...@@ -62,7 +62,7 @@ BSTR BSTRFromCStr(UINT codePage, LPCSTR s) ...@@ -62,7 +62,7 @@ BSTR BSTRFromCStr(UINT codePage, LPCSTR s)
ZeroMemory(wideStr, wideLen*sizeof(WCHAR)); ZeroMemory(wideStr, wideLen*sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, s, -1, wideStr, wideLen); MultiByteToWideChar(codePage, 0, s, -1, wideStr, wideLen);
bstr = SysAllocStringLen(wideStr, wideLen); bstr = SysAllocStringLen(wideStr, wideLen);
free(wideStr); CoTaskMemFree(wideStr);
return bstr; return bstr;
} }
...@@ -105,22 +105,26 @@ HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v) ...@@ -105,22 +105,26 @@ HRESULT GetObjectProperty(LPUNKNOWN object, DISPID dispID, VARIANT& v)
HDC CreateDevDC(DVTARGETDEVICE *ptd) HDC CreateDevDC(DVTARGETDEVICE *ptd)
{ {
HDC hdc=NULL; HDC hdc=NULL;
if( NULL == ptd )
{
hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
}
else
{
LPDEVNAMES lpDevNames; LPDEVNAMES lpDevNames;
LPDEVMODE lpDevMode; LPDEVMODE lpDevMode;
LPTSTR lpszDriverName; LPTSTR lpszDriverName;
LPTSTR lpszDeviceName; LPTSTR lpszDeviceName;
LPTSTR lpszPortName; LPTSTR lpszPortName;
if (ptd == NULL) {
hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
goto errReturn;
}
lpDevNames = (LPDEVNAMES) ptd; // offset for size field lpDevNames = (LPDEVNAMES) ptd; // offset for size field
if (ptd->tdExtDevmodeOffset == 0) { if (ptd->tdExtDevmodeOffset == 0)
{
lpDevMode = NULL; lpDevMode = NULL;
}else{ }
else
{
lpDevMode = (LPDEVMODE) ((LPTSTR)ptd + ptd->tdExtDevmodeOffset); lpDevMode = (LPDEVMODE) ((LPTSTR)ptd + ptd->tdExtDevmodeOffset);
} }
...@@ -129,8 +133,7 @@ HDC CreateDevDC(DVTARGETDEVICE *ptd) ...@@ -129,8 +133,7 @@ HDC CreateDevDC(DVTARGETDEVICE *ptd)
lpszPortName = (LPTSTR) lpDevNames + ptd->tdPortNameOffset; lpszPortName = (LPTSTR) lpDevNames + ptd->tdPortNameOffset;
hdc = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode); hdc = CreateDC(lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode);
}
errReturn:
return hdc; return hdc;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment