4 * Copyright 2008 James Hawkins
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/debug.h"
30 #include "wine/unicode.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(propsys
);
34 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
36 TRACE("(0x%p, %d, %p)\n", hinstDLL
, fdwReason
, lpvReserved
);
40 case DLL_WINE_PREATTACH
:
41 return FALSE
; /* prefer native version */
42 case DLL_PROCESS_ATTACH
:
43 DisableThreadLibraryCalls(hinstDLL
);
45 case DLL_PROCESS_DETACH
:
54 HRESULT WINAPI
PSRegisterPropertySchema(PCWSTR path
)
56 FIXME("%s stub\n", debugstr_w(path
));
61 HRESULT WINAPI
PSUnregisterPropertySchema(PCWSTR path
)
63 FIXME("%s stub\n", debugstr_w(path
));
68 HRESULT WINAPI
PSStringFromPropertyKey(REFPROPERTYKEY pkey
, LPWSTR psz
, UINT cch
)
70 static const WCHAR guid_fmtW
[] = {'{','%','0','8','X','-','%','0','4','X','-',
71 '%','0','4','X','-','%','0','2','X','%','0','2','X','-',
72 '%','0','2','X','%','0','2','X','%','0','2','X',
73 '%','0','2','X','%','0','2','X','%','0','2','X','}',0};
74 static const WCHAR pid_fmtW
[] = {'%','u',0};
76 WCHAR pidW
[PKEY_PIDSTR_MAX
+ 1];
80 TRACE("(%p, %p, %u)\n", pkey
, psz
, cch
);
85 /* GUIDSTRING_MAX accounts for null terminator, +1 for space character. */
86 if (cch
<= GUIDSTRING_MAX
+ 1)
87 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
92 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
95 sprintfW(psz
, guid_fmtW
, pkey
->fmtid
.Data1
, pkey
->fmtid
.Data2
,
96 pkey
->fmtid
.Data3
, pkey
->fmtid
.Data4
[0], pkey
->fmtid
.Data4
[1],
97 pkey
->fmtid
.Data4
[2], pkey
->fmtid
.Data4
[3], pkey
->fmtid
.Data4
[4],
98 pkey
->fmtid
.Data4
[5], pkey
->fmtid
.Data4
[6], pkey
->fmtid
.Data4
[7]);
100 /* Overwrite the null terminator with the space character. */
101 p
+= GUIDSTRING_MAX
- 1;
103 cch
-= GUIDSTRING_MAX
- 1 + 1;
105 len
= sprintfW(pidW
, pid_fmtW
, pkey
->pid
);
114 WCHAR
*ptr
= pidW
+ len
- 1;
120 /* Replicate a quirk of the native implementation where the contents
121 * of the property ID string are written backwards to the output
122 * buffer, skipping the rightmost digit. */
130 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);