/*
-* COPYRIGHT: See COPYING in the top level directory
+ * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Display Control Panel
- * FILE: lib/cpl/desk/devsett.c
+ * FILE: dll/cpl/desk/devsett.c
* PURPOSE: ReactOS Display Control Panel Shell Extension Support
*/
#include "desk.h"
+#include <cfgmgr32.h>
+
#define NDEBUG
#include <debug.h>
const struct IDataObjectVtbl *lpIDataObjectVtbl;
DWORD ref;
- CLIPFORMAT cfExtInterface; /* "Desk.cpl extension interface" */
- CLIPFORMAT cfDisplayDevice; /* "Display Device" */
- CLIPFORMAT cfDisplayName; /* "Display Name" */
- CLIPFORMAT cfDisplayId; /* "Display ID" */
- CLIPFORMAT cfMonitorName; /* "Monitor Name" */
- CLIPFORMAT cfMonitorDevice; /* "Monitor Device" */
- CLIPFORMAT cfDisplayKey; /* "Display Key" */
+ CLIPFORMAT cfExtInterface; /* "Desk.cpl extension interface" */
+ CLIPFORMAT cfDisplayDevice; /* "Display Device" */
+ CLIPFORMAT cfDisplayName; /* "Display Name" */
+ CLIPFORMAT cfDisplayId; /* "Display ID" */
+ CLIPFORMAT cfMonitorName; /* "Monitor Name" */
+ CLIPFORMAT cfMonitorDevice; /* "Monitor Device" */
+ CLIPFORMAT cfDisplayKey; /* "Display Key" */
CLIPFORMAT cfDisplayStateFlags; /* "Display State Flags" */
- CLIPFORMAT cfPruningMode; /* "Pruning Mode" */
+ CLIPFORMAT cfPruningMode; /* "Pruning Mode" */
PWSTR pDisplayDevice;
PWSTR pDisplayName;
if (str != NULL)
{
#ifdef UNICODE
- wcscpy(str,
+ StringCbCopyW(str, c * sizeof(WCHAR),
pszSrc);
#else
MultiByteToWideChar(CP_ACP,
CM_LOCATE_DEVNODE_NORMAL);
if (cr == CR_SUCCESS)
{
- DbgPrint("Success1\n");
+ DPRINT1("Success1\n");
cr = CM_Get_Device_ID_Size(&BufLen,
DevInst,
0);
if (cr == CR_SUCCESS)
{
- DbgPrint("Success2\n");
+ DPRINT1("Success2\n");
lpDevInstId = LocalAlloc(LMEM_FIXED,
(BufLen + 1) * sizeof(WCHAR));
if (lpDevInstId != NULL)
{
- DbgPrint("Success3\n");
+ DPRINT1("Success3\n");
cr = CM_Get_Device_IDW(DevInst,
lpDevInstId,
BufLen,
LocalFree((HLOCAL)lpDevInstId);
lpDevInstId = NULL;
}
- DbgPrint("instance id: %ws\n", lpDevInstId);
+ DPRINT1("instance id: %ws\n", lpDevInstId);
}
}
}
PCWSTR pszRet = NULL;
PWSTR pszBuf;
PCDevSettings This = impl_from_IDataObject(iface);
-
+
ZeroMemory(pmedium,
sizeof(STGMEDIUM));
pszRet = szEmpty;
pszBuf = GlobalAlloc(GPTR,
- (_tcslen(pszRet) + 1) * sizeof(WCHAR));
+ (wcslen(pszRet) + 1) * sizeof(WCHAR));
if (pszBuf != NULL)
{
- _tcscpy(pszBuf,
- pszRet);
+ hr = StringCbCopy(pszBuf, (wcslen(pszRet) + 1) * sizeof(WCHAR), pszRet);
+ if (FAILED(hr))
+ {
+ GlobalFree(pszBuf);
+ return hr;
+ }
pmedium->tymed = TYMED_HGLOBAL;
pmedium->hGlobal = pszBuf;