2008-01-16 07:11:17 +01:00
|
|
|
/*
|
|
|
|
* propsys main
|
|
|
|
*
|
|
|
|
* Copyright 2008 James Hawkins
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2010-07-26 04:57:37 +02:00
|
|
|
#include "objbase.h"
|
|
|
|
#include "propsys.h"
|
2008-01-16 07:11:17 +01:00
|
|
|
#include "wine/debug.h"
|
2010-07-26 04:57:37 +02:00
|
|
|
#include "wine/unicode.h"
|
2008-01-16 07:11:17 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(propsys);
|
|
|
|
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
|
|
|
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
|
|
|
|
|
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_WINE_PREATTACH:
|
|
|
|
return FALSE; /* prefer native version */
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
|
|
|
break;
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2009-02-03 15:36:44 +01:00
|
|
|
|
|
|
|
HRESULT WINAPI PSRegisterPropertySchema(PCWSTR path)
|
|
|
|
{
|
2010-06-14 21:26:39 +02:00
|
|
|
FIXME("%s stub\n", debugstr_w(path));
|
2009-02-03 15:36:44 +01:00
|
|
|
|
2010-06-14 14:20:49 +02:00
|
|
|
return S_OK;
|
2009-02-03 15:36:44 +01:00
|
|
|
}
|
2009-03-19 15:46:45 +01:00
|
|
|
|
2010-06-14 14:20:49 +02:00
|
|
|
HRESULT WINAPI PSUnregisterPropertySchema(PCWSTR path)
|
2009-03-19 15:46:45 +01:00
|
|
|
{
|
2010-06-14 21:26:39 +02:00
|
|
|
FIXME("%s stub\n", debugstr_w(path));
|
2009-03-19 15:46:45 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2010-07-26 04:57:37 +02:00
|
|
|
|
|
|
|
HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY pkey, LPWSTR psz, UINT cch)
|
|
|
|
{
|
|
|
|
static const WCHAR guid_fmtW[] = {'{','%','0','8','X','-','%','0','4','X','-',
|
|
|
|
'%','0','4','X','-','%','0','2','X','%','0','2','X','-',
|
|
|
|
'%','0','2','X','%','0','2','X','%','0','2','X',
|
|
|
|
'%','0','2','X','%','0','2','X','%','0','2','X','}',0};
|
|
|
|
static const WCHAR pid_fmtW[] = {'%','u',0};
|
|
|
|
|
|
|
|
WCHAR pidW[PKEY_PIDSTR_MAX + 1];
|
|
|
|
LPWSTR p = psz;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %u)\n", pkey, psz, cch);
|
|
|
|
|
|
|
|
if (!psz)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
/* GUIDSTRING_MAX accounts for null terminator, +1 for space character. */
|
|
|
|
if (cch <= GUIDSTRING_MAX + 1)
|
|
|
|
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
|
|
|
|
if (!pkey)
|
|
|
|
{
|
|
|
|
psz[0] = '\0';
|
|
|
|
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintfW(psz, guid_fmtW, pkey->fmtid.Data1, pkey->fmtid.Data2,
|
|
|
|
pkey->fmtid.Data3, pkey->fmtid.Data4[0], pkey->fmtid.Data4[1],
|
|
|
|
pkey->fmtid.Data4[2], pkey->fmtid.Data4[3], pkey->fmtid.Data4[4],
|
|
|
|
pkey->fmtid.Data4[5], pkey->fmtid.Data4[6], pkey->fmtid.Data4[7]);
|
|
|
|
|
|
|
|
/* Overwrite the null terminator with the space character. */
|
|
|
|
p += GUIDSTRING_MAX - 1;
|
|
|
|
*p++ = ' ';
|
|
|
|
cch -= GUIDSTRING_MAX - 1 + 1;
|
|
|
|
|
|
|
|
len = sprintfW(pidW, pid_fmtW, pkey->pid);
|
|
|
|
|
|
|
|
if (cch >= len + 1)
|
|
|
|
{
|
|
|
|
strcpyW(p, pidW);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WCHAR *ptr = pidW + len - 1;
|
|
|
|
|
|
|
|
psz[0] = '\0';
|
|
|
|
*p++ = '\0';
|
|
|
|
cch--;
|
|
|
|
|
|
|
|
/* Replicate a quirk of the native implementation where the contents
|
|
|
|
* of the property ID string are written backwards to the output
|
|
|
|
* buffer, skipping the rightmost digit. */
|
|
|
|
if (cch)
|
|
|
|
{
|
|
|
|
ptr--;
|
|
|
|
while (cch--)
|
|
|
|
*p++ = *ptr--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
}
|
|
|
|
}
|