ReactOS 0.4.17-dev-343-gb35a9be
main.c
Go to the documentation of this file.
1/*
2 * Copyright 2002 Jon Griffiths
3 * Copyright 2016 Sebastian Lackner
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include <stdarg.h>
21
22#define COBJMACROS
23
24#include "windef.h"
25#include "winbase.h"
26#include "wingdi.h"
27#include "winuser.h"
28#include "initguid.h"
29#include "ocidl.h"
30#include "featurestagingapi.h"
31#include "shellscalingapi.h"
32#include "shcore.h"
33#define WINSHLWAPI
34#include "shlwapi.h"
35
36#include "wine/debug.h"
37
39
42
44{
45 TRACE("%p, %lu, %p.\n", instance, reason, reserved);
46
47 switch (reason)
48 {
52 break;
54 if (reserved) break;
57 break;
58 }
59
60 return TRUE;
61}
62
63#ifndef __REACTOS__
65{
68}
69
71{
74}
75
77{
78 if (GetDpiForMonitorInternal( monitor, type, x, y )) return S_OK;
80}
81#endif /* __REACTOS__ */
82
84{
85 FIXME("(%p %p): stub\n", monitor, scale);
86
88 return S_OK;
89}
90
92{
93 FIXME("%d\n", device_type);
94
95 return SCALE_100_PERCENT;
96}
97
99{
100 ULONG read;
101 HRESULT hr;
102
103 TRACE("%p, %p, %lu.\n", stream, dest, size);
104
105 hr = IStream_Read(stream, dest, size, &read);
106 if (SUCCEEDED(hr) && read != size)
107 hr = E_FAIL;
108 return hr;
109}
110
112{
113 static const LARGE_INTEGER zero;
114
115 TRACE("(%p)\n", stream);
116
117 return IStream_Seek(stream, zero, 0, NULL);
118}
119
121{
122 STATSTG statstg;
123 HRESULT hr;
124
125 TRACE("(%p, %p)\n", stream, size);
126
127 memset(&statstg, 0, sizeof(statstg));
128
129 hr = IStream_Stat(stream, &statstg, STATFLAG_NONAME);
130
131 if (SUCCEEDED(hr) && size)
132 *size = statstg.cbSize;
133 return hr;
134}
135
137{
138 ULONG written;
139 HRESULT hr;
140
141 TRACE("%p, %p, %lu.\n", stream, src, size);
142
143 hr = IStream_Write(stream, src, size, &written);
144 if (SUCCEEDED(hr) && written != size)
145 hr = E_FAIL;
146
147 return hr;
148}
149
151{
152 TRACE("(%p)\n", obj);
153
154 if (!obj || !*obj)
155 return;
156
157 IUnknown_Release(*obj);
158 *obj = NULL;
159}
160
162{
165
166 TRACE("(%p, %s, %p)\n", unk, debugstr_guid(iid), site);
167
168 if (unk && iid && site)
169 {
170 hr = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void **)&obj);
171 if (SUCCEEDED(hr) && obj)
172 {
173 hr = IObjectWithSite_GetSite(obj, iid, site);
174 IObjectWithSite_Release(obj);
175 }
176 }
177
178 return hr;
179}
180
182{
183 IServiceProvider *provider = NULL;
184 HRESULT hr;
185
186 if (!out)
187 return E_FAIL;
188
189 *out = NULL;
190
191 if (!obj)
192 return E_FAIL;
193
194 hr = IUnknown_QueryInterface(obj, &IID_IServiceProvider, (void **)&provider);
195 if (hr == S_OK && provider)
196 {
197 TRACE("Using provider %p.\n", provider);
198
199 hr = IServiceProvider_QueryService(provider, sid, iid, out);
200
201 TRACE("Provider %p returned %p.\n", provider, *out);
202
203 IServiceProvider_Release(provider);
204 }
205
206 return hr;
207}
208
210{
211 TRACE("(%p, %p)\n", dest, src);
212
214
215 if (src)
216 {
217 IUnknown_AddRef(src);
218 *dest = src;
219 }
220}
221
223{
224 IInternetSecurityManager *sec_manager;
225 IObjectWithSite *objwithsite;
226 HRESULT hr;
227
228 if (!obj)
229 return E_FAIL;
230
231 hr = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (void **)&objwithsite);
232 TRACE("ObjectWithSite %p, hr %#lx.\n", objwithsite, hr);
233 if (SUCCEEDED(hr))
234 {
235 hr = IObjectWithSite_SetSite(objwithsite, site);
236 TRACE("SetSite() hr %#lx.\n", hr);
237 IObjectWithSite_Release(objwithsite);
238 }
239 else
240 {
241 hr = IUnknown_QueryInterface(obj, &IID_IInternetSecurityManager, (void **)&sec_manager);
242 TRACE("InternetSecurityManager %p, hr %#lx.\n", sec_manager, hr);
243 if (FAILED(hr))
244 return hr;
245
246 hr = IInternetSecurityManager_SetSecuritySite(sec_manager, (IInternetSecurityMgrSite *)site);
247 TRACE("SetSecuritySite() hr %#lx.\n", hr);
248 IInternetSecurityManager_Release(sec_manager);
249 }
250
251 return hr;
252}
253
255{
256 FIXME("%s: stub\n", debugstr_w(appid));
257 return S_OK;
258}
259
261{
262 FIXME("%p: stub\n", appid);
263 *appid = NULL;
264 return E_NOTIMPL;
265}
266
267/*************************************************************************
268 * CommandLineToArgvW [SHCORE.@]
269 *
270 * We must interpret the quotes in the command line to rebuild the argv
271 * array correctly:
272 * - arguments are separated by spaces or tabs
273 * - quotes serve as optional argument delimiters
274 * '"a b"' -> 'a b'
275 * - escaped quotes must be converted back to '"'
276 * '\"' -> '"'
277 * - consecutive backslashes preceding a quote see their number halved with
278 * the remainder escaping the quote:
279 * 2n backslashes + quote -> n backslashes + quote as an argument delimiter
280 * 2n+1 backslashes + quote -> n backslashes + literal quote
281 * - backslashes that are not followed by a quote are copied literally:
282 * 'a\b' -> 'a\b'
283 * 'a\\b' -> 'a\\b'
284 * - in quoted strings, consecutive quotes see their number divided by three
285 * with the remainder modulo 3 deciding whether to close the string or not.
286 * Note that the opening quote must be counted in the consecutive quotes,
287 * that's the (1+) below:
288 * (1+) 3n quotes -> n quotes
289 * (1+) 3n+1 quotes -> n quotes plus closes the quoted string
290 * (1+) 3n+2 quotes -> n+1 quotes plus closes the quoted string
291 * - in unquoted strings, the first quote opens the quoted string and the
292 * remaining consecutive quotes follow the above rule.
293 */
295{
296 int qcount, bcount;
297 const WCHAR *s;
298 WCHAR **argv;
299 DWORD argc;
300 WCHAR *d;
301
302 if (!numargs)
303 {
305 return NULL;
306 }
307
308 if (*cmdline == 0)
309 {
310 /* Return the path to the executable */
311 DWORD len, deslen = MAX_PATH, size;
312
313 size = sizeof(WCHAR *) * 2 + deslen * sizeof(WCHAR);
314 for (;;)
315 {
316 if (!(argv = LocalAlloc(LMEM_FIXED, size))) return NULL;
317 len = GetModuleFileNameW(0, (WCHAR *)(argv + 2), deslen);
318 if (!len)
319 {
321 return NULL;
322 }
323 if (len < deslen) break;
324 deslen *= 2;
325 size = sizeof(WCHAR *) * 2 + deslen * sizeof(WCHAR);
327 }
328 argv[0] = (WCHAR *)(argv + 2);
329 argv[1] = NULL;
330 *numargs = 1;
331
332 return argv;
333 }
334
335 /* --- First count the arguments */
336 argc = 1;
337 s = cmdline;
338 /* The first argument, the executable path, follows special rules */
339 if (*s == '"')
340 {
341 /* The executable path ends at the next quote, no matter what */
342 s++;
343 while (*s)
344 if (*s++ == '"')
345 break;
346 }
347 else
348 {
349 /* The executable path ends at the next space, no matter what */
350 while (*s && *s != ' ' && *s != '\t')
351 s++;
352 }
353 /* skip to the first argument, if any */
354 while (*s == ' ' || *s == '\t')
355 s++;
356 if (*s)
357 argc++;
358
359 /* Analyze the remaining arguments */
360 qcount = bcount = 0;
361 while (*s)
362 {
363 if ((*s == ' ' || *s == '\t') && qcount == 0)
364 {
365 /* skip to the next argument and count it if any */
366 while (*s == ' ' || *s == '\t')
367 s++;
368 if (*s)
369 argc++;
370 bcount = 0;
371 }
372 else if (*s == '\\')
373 {
374 /* '\', count them */
375 bcount++;
376 s++;
377 }
378 else if (*s == '"')
379 {
380 /* '"' */
381 if ((bcount & 1) == 0)
382 qcount++; /* unescaped '"' */
383 s++;
384 bcount = 0;
385 /* consecutive quotes, see comment in copying code below */
386 while (*s == '"')
387 {
388 qcount++;
389 s++;
390 }
391 qcount = qcount % 3;
392 if (qcount == 2)
393 qcount = 0;
394 }
395 else
396 {
397 /* a regular character */
398 bcount = 0;
399 s++;
400 }
401 }
402
403 /* Allocate in a single lump, the string array, and the strings that go
404 * with it. This way the caller can make a single LocalFree() call to free
405 * both, as per MSDN.
406 */
407 argv = LocalAlloc(LMEM_FIXED, (argc + 1) * sizeof(WCHAR *) + (lstrlenW(cmdline) + 1) * sizeof(WCHAR));
408 if (!argv)
409 return NULL;
410
411 /* --- Then split and copy the arguments */
412 argv[0] = d = lstrcpyW((WCHAR *)(argv + argc + 1), cmdline);
413 argc = 1;
414 /* The first argument, the executable path, follows special rules */
415 if (*d == '"')
416 {
417 /* The executable path ends at the next quote, no matter what */
418 s = d + 1;
419 while (*s)
420 {
421 if (*s == '"')
422 {
423 s++;
424 break;
425 }
426 *d++ = *s++;
427 }
428 }
429 else
430 {
431 /* The executable path ends at the next space, no matter what */
432 while (*d && *d != ' ' && *d != '\t')
433 d++;
434 s = d;
435 if (*s)
436 s++;
437 }
438 /* close the executable path */
439 *d++ = 0;
440 /* skip to the first argument and initialize it if any */
441 while (*s == ' ' || *s == '\t')
442 s++;
443 if (!*s)
444 {
445 /* There are no parameters so we are all done */
446 argv[argc] = NULL;
447 *numargs = argc;
448 return argv;
449 }
450
451 /* Split and copy the remaining arguments */
452 argv[argc++] = d;
453 qcount = bcount = 0;
454 while (*s)
455 {
456 if ((*s == ' ' || *s == '\t') && qcount == 0)
457 {
458 /* close the argument */
459 *d++ = 0;
460 bcount = 0;
461
462 /* skip to the next one and initialize it if any */
463 do {
464 s++;
465 } while (*s == ' ' || *s == '\t');
466 if (*s)
467 argv[argc++] = d;
468 }
469 else if (*s=='\\')
470 {
471 *d++ = *s++;
472 bcount++;
473 }
474 else if (*s == '"')
475 {
476 if ((bcount & 1) == 0)
477 {
478 /* Preceded by an even number of '\', this is half that
479 * number of '\', plus a quote which we erase.
480 */
481 d -= bcount / 2;
482 qcount++;
483 }
484 else
485 {
486 /* Preceded by an odd number of '\', this is half that
487 * number of '\' followed by a '"'
488 */
489 d = d - bcount / 2 - 1;
490 *d++ = '"';
491 }
492 s++;
493 bcount = 0;
494 /* Now count the number of consecutive quotes. Note that qcount
495 * already takes into account the opening quote if any, as well as
496 * the quote that lead us here.
497 */
498 while (*s == '"')
499 {
500 if (++qcount == 3)
501 {
502 *d++ = '"';
503 qcount = 0;
504 }
505 s++;
506 }
507 if (qcount == 2)
508 qcount = 0;
509 }
510 else
511 {
512 /* a regular character */
513 *d++ = *s++;
514 bcount = 0;
515 }
516 }
517 *d = '\0';
518 argv[argc] = NULL;
519 *numargs = argc;
520
521 return argv;
522}
523
525{
528
529 union
530 {
531 struct
532 {
536
540 struct
541 {
546 } u;
547};
548
549static inline struct shstream *impl_from_IStream(IStream *iface)
550{
551 return CONTAINING_RECORD(iface, struct shstream, IStream_iface);
552}
553
555{
556 struct shstream *stream = impl_from_IStream(iface);
557
558 TRACE("(%p)->(%s, %p)\n", stream, debugstr_guid(riid), out);
559
561 IsEqualIID(riid, &IID_IStream) ||
562 IsEqualIID(riid, &IID_ISequentialStream))
563 {
564 *out = iface;
565 IStream_AddRef(iface);
566 return S_OK;
567 }
568
569 *out = NULL;
570 WARN("Unsupported interface %s.\n", debugstr_guid(riid));
571 return E_NOINTERFACE;
572}
573
575{
576 struct shstream *stream = impl_from_IStream(iface);
578
579 TRACE("%p, refcount %lu.\n", iface, refcount);
580
581 return refcount;
582}
583
585{
586 struct shstream *stream = impl_from_IStream(iface);
588
589 TRACE("%p, refcount %lu.\n", iface, refcount);
590
591 if (!refcount)
592 {
593 free(stream->u.mem.buffer);
594 free(stream);
595 }
596
597 return refcount;
598}
599
600static HRESULT WINAPI memstream_Read(IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
601{
602 struct shstream *stream = impl_from_IStream(iface);
604
605 TRACE("%p, %p, %lu, %p.\n", iface, buff, buff_size, read_len);
606
607 if (stream->u.mem.position >= stream->u.mem.length)
608 {
609 if (read_len)
610 *read_len = 0;
611 return S_FALSE;
612 }
613
614 length = stream->u.mem.length - stream->u.mem.position;
615 if (buff_size < length)
616 length = buff_size;
617
618 memmove(buff, stream->u.mem.buffer + stream->u.mem.position, length);
619 stream->u.mem.position += length;
620
621 if (read_len)
622 *read_len = length;
623
624 return S_OK;
625}
626
627static HRESULT WINAPI memstream_Write(IStream *iface, const void *buff, ULONG buff_size, ULONG *written)
628{
629 struct shstream *stream = impl_from_IStream(iface);
630 DWORD length = stream->u.mem.position + buff_size;
631
632 TRACE("%p, %p, %lu, %p.\n", iface, buff, buff_size, written);
633
634 if (length < stream->u.mem.position) /* overflow */
636
637 if (length > stream->u.mem.length)
638 {
639 BYTE *buffer = _recalloc(stream->u.mem.buffer, 1, length);
640 if (!buffer)
642
643 stream->u.mem.length = length;
644 stream->u.mem.buffer = buffer;
645 }
646 memmove(stream->u.mem.buffer + stream->u.mem.position, buff, buff_size);
647 stream->u.mem.position += buff_size; /* adjust pointer */
648
649 if (written)
650 *written = buff_size;
651
652 return S_OK;
653}
654
656{
657 struct shstream *stream = impl_from_IStream(iface);
658 LARGE_INTEGER tmp;
659
660 TRACE("%p, %s, %ld, %p.\n", iface, wine_dbgstr_longlong(move.QuadPart), origin, new_pos);
661
662 if (origin == STREAM_SEEK_SET)
663 tmp = move;
664 else if (origin == STREAM_SEEK_CUR)
665 tmp.QuadPart = stream->u.mem.position + move.QuadPart;
666 else if (origin == STREAM_SEEK_END)
667 tmp.QuadPart = stream->u.mem.length + move.QuadPart;
668 else
670
671 if (tmp.QuadPart < 0)
673
674 /* we cut off the high part here */
675 stream->u.mem.position = tmp.u.LowPart;
676
677 if (new_pos)
678 new_pos->QuadPart = stream->u.mem.position;
679 return S_OK;
680}
681
683{
684 struct shstream *stream = impl_from_IStream(iface);
686 BYTE *buffer;
687
688 TRACE("(%p, %s)\n", stream, wine_dbgstr_longlong(new_size.QuadPart));
689
690 /* we cut off the high part here */
691 length = new_size.u.LowPart;
692 buffer = _recalloc(stream->u.mem.buffer, 1, length);
693 if (!buffer)
695
696 stream->u.mem.buffer = buffer;
697 stream->u.mem.length = length;
698
699 return S_OK;
700}
701
703 ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
704{
705 struct shstream *stream = impl_from_IStream(iface);
706 ULARGE_INTEGER total_read, total_written;
707 HRESULT hr = S_OK;
708 BYTE buffer[0x400];
709
710 TRACE("(%p, %p, %s, %p, %p)\n", stream, dest, wine_dbgstr_longlong(size.QuadPart), read_len, written);
711
712 if (!dest)
713 return E_POINTER;
714
715 total_read.QuadPart = 0;
716 total_written.QuadPart = 0;
717
718 while (size.QuadPart > 0)
719 {
720 ULONG chunk_size = size.QuadPart >= sizeof(buffer) ? sizeof(buffer) : size.u.LowPart;
721 ULONG chunk_read, chunk_written;
722
723 hr = IStream_Read(iface, buffer, chunk_size, &chunk_read);
724 if (FAILED(hr))
725 break;
726
727 total_read.QuadPart += chunk_read;
728
729 if (chunk_read)
730 {
731 hr = IStream_Write(dest, buffer, chunk_read, &chunk_written);
732 if (FAILED(hr))
733 break;
734
735 total_written.QuadPart += chunk_written;
736 }
737
738 if (chunk_read != chunk_size)
739 size.QuadPart = 0;
740 else
741 size.QuadPart -= chunk_read;
742 }
743
744 if (read_len)
745 read_len->QuadPart = total_read.QuadPart;
746 if (written)
747 written->QuadPart = total_written.QuadPart;
748
749 return hr;
750}
751
753{
754 TRACE("%p, %#lx.\n", iface, flags);
755
756 /* Commit is not supported by this stream */
757 return E_NOTIMPL;
758}
759
761{
762 struct shstream *stream = impl_from_IStream(iface);
763
764 TRACE("(%p)\n", stream);
765
766 /* revert not supported by this stream */
767 return E_NOTIMPL;
768}
769
771{
772 struct shstream *stream = impl_from_IStream(iface);
773
774 TRACE("(%p)\n", stream);
775
776 /* lock/unlock not supported by this stream */
777 return E_NOTIMPL;
778}
779
781{
782 struct shstream *stream = impl_from_IStream(iface);
783
784 TRACE("(%p)\n", stream);
785
786 /* lock/unlock not supported by this stream */
787 return E_NOTIMPL;
788}
789
790static HRESULT WINAPI memstream_Stat(IStream *iface, STATSTG *statstg, DWORD flags)
791{
792 struct shstream *stream = impl_from_IStream(iface);
793
794 TRACE("%p, %p, %#lx.\n", iface, statstg, flags);
795
796 memset(statstg, 0, sizeof(*statstg));
797 statstg->type = STGTY_STREAM;
798 statstg->cbSize.QuadPart = stream->u.mem.length;
799 statstg->grfMode = STGM_READWRITE;
800
801 return S_OK;
802}
803
805{
806 struct shstream *stream = impl_from_IStream(iface);
807
808 TRACE("(%p, %p)\n", stream, dest);
809
810 *dest = NULL;
811
812 /* clone not supported by this stream */
813 return E_NOTIMPL;
814}
815
816static const IStreamVtbl memstreamvtbl =
817{
832};
833
834static struct shstream *shstream_create(const IStreamVtbl *vtbl, const BYTE *data, UINT data_len)
835{
836 struct shstream *stream;
837
838 if (!data)
839 data_len = 0;
840
841 stream = malloc(sizeof(*stream));
842 stream->IStream_iface.lpVtbl = vtbl;
843 stream->refcount = 1;
844 stream->u.mem.buffer = malloc(data_len);
845 if (!stream->u.mem.buffer)
846 {
847 free(stream);
848 return NULL;
849 }
850 memcpy(stream->u.mem.buffer, data, data_len);
851 stream->u.mem.length = data_len;
852 stream->u.mem.position = 0;
853
854 return stream;
855}
856
857/*************************************************************************
858 * SHCreateMemStream [SHCORE.@]
859 *
860 * Create an IStream object on a block of memory.
861 *
862 * PARAMS
863 * data [I] Memory block to create the IStream object on
864 * data_len [I] Length of data block
865 *
866 * RETURNS
867 * Success: A pointer to the IStream object.
868 * Failure: NULL, if any parameters are invalid or an error occurs.
869 *
870 * NOTES
871 * A copy of the memory block is made, it's freed when the stream is released.
872 */
874{
875 struct shstream *stream;
876
877 TRACE("(%p, %u)\n", data, data_len);
878
880 return stream ? &stream->IStream_iface : NULL;
881}
882
884{
885 struct shstream *stream = impl_from_IStream(iface);
887
888 TRACE("%p, refcount %lu.\n", iface, refcount);
889
890 if (!refcount)
891 {
892 CloseHandle(stream->u.file.handle);
893 free(stream->u.file.path);
894 free(stream);
895 }
896
897 return refcount;
898}
899
900static HRESULT WINAPI filestream_Read(IStream *iface, void *buff, ULONG size, ULONG *read_len)
901{
902 struct shstream *stream = impl_from_IStream(iface);
903 DWORD read = 0;
904
905 TRACE("%p, %p, %lu, %p.\n", iface, buff, size, read_len);
906
907 if (!ReadFile(stream->u.file.handle, buff, size, &read, NULL))
908 {
909 WARN("error %ld reading file\n", GetLastError());
910 return S_FALSE;
911 }
912
913 if (read_len)
914 *read_len = read;
915
916 return read == size ? S_OK : S_FALSE;
917}
918
919static HRESULT WINAPI filestream_Write(IStream *iface, const void *buff, ULONG size, ULONG *written)
920{
921 struct shstream *stream = impl_from_IStream(iface);
922 DWORD written_len = 0;
923
924 TRACE("%p, %p, %lu, %p.\n", iface, buff, size, written);
925
926 switch (stream->u.file.mode & 0xf)
927 {
928 case STGM_WRITE:
929 case STGM_READWRITE:
930 break;
931 default:
932 return STG_E_ACCESSDENIED;
933 }
934
935 if (!WriteFile(stream->u.file.handle, buff, size, &written_len, NULL))
937
938 if (written)
939 *written = written_len;
940
941 return S_OK;
942}
943
945{
946 struct shstream *stream = impl_from_IStream(iface);
948
949 TRACE("%p, %s, %ld, %p.\n", iface, wine_dbgstr_longlong(move.QuadPart), origin, new_pos);
950
951 position = SetFilePointer(stream->u.file.handle, move.u.LowPart, NULL, origin);
954
955 if (new_pos)
956 {
957 new_pos->u.HighPart = 0;
958 new_pos->u.LowPart = position;
959 }
960
961 return S_OK;
962}
963
965{
966 struct shstream *stream = impl_from_IStream(iface);
967 LARGE_INTEGER origin, move;
968
969 TRACE("(%p, %s)\n", stream, wine_dbgstr_longlong(size.QuadPart));
970
971 move.QuadPart = 0;
972 if (!SetFilePointerEx(stream->u.file.handle, move, &origin, FILE_CURRENT))
973 return E_FAIL;
974
975 move.QuadPart = size.QuadPart;
976 if (!SetFilePointerEx(stream->u.file.handle, move, NULL, FILE_BEGIN))
977 return E_FAIL;
978
979 if (stream->u.file.mode != STGM_READ)
980 {
981 if (!SetEndOfFile(stream->u.file.handle))
982 return E_FAIL;
983 if (!SetFilePointerEx(stream->u.file.handle, origin, NULL, FILE_BEGIN))
984 return E_FAIL;
985 }
986
987 return S_OK;
988}
989
991 ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
992{
993 struct shstream *stream = impl_from_IStream(iface);
994 HRESULT hr = S_OK;
995 char buff[1024];
996
997 TRACE("(%p, %p, %s, %p, %p)\n", stream, dest, wine_dbgstr_longlong(size.QuadPart), read_len, written);
998
999 if (read_len)
1000 read_len->QuadPart = 0;
1001 if (written)
1002 written->QuadPart = 0;
1003
1004 if (!dest)
1005 return S_OK;
1006
1007 while (size.QuadPart)
1008 {
1009 ULONG left, read_chunk, written_chunk;
1010
1011 left = size.QuadPart > sizeof(buff) ? sizeof(buff) : size.QuadPart;
1012
1013 /* Read */
1014 hr = IStream_Read(iface, buff, left, &read_chunk);
1015 if (FAILED(hr) || read_chunk == 0)
1016 break;
1017 if (read_len)
1018 read_len->QuadPart += read_chunk;
1019
1020 /* Write */
1021 hr = IStream_Write(dest, buff, read_chunk, &written_chunk);
1022 if (written)
1023 written->QuadPart += written_chunk;
1024 if (FAILED(hr) || written_chunk != left)
1025 break;
1026
1027 size.QuadPart -= left;
1028 }
1029
1030 return hr;
1031}
1032
1034{
1035 TRACE("%p, %#lx.\n", iface, flags);
1036
1037 return S_OK;
1038}
1039
1040static HRESULT WINAPI filestream_Stat(IStream *iface, STATSTG *statstg, DWORD flags)
1041{
1042 struct shstream *stream = impl_from_IStream(iface);
1044
1045 TRACE("%p, %p, %#lx.\n", iface, statstg, flags);
1046
1047 if (!statstg)
1048 return STG_E_INVALIDPOINTER;
1049
1050 memset(&fi, 0, sizeof(fi));
1051 GetFileInformationByHandle(stream->u.file.handle, &fi);
1052
1053 if (flags & STATFLAG_NONAME)
1054 statstg->pwcsName = NULL;
1055 else
1056 {
1057 int len = lstrlenW(stream->u.file.path);
1058 if ((statstg->pwcsName = CoTaskMemAlloc((len + 1) * sizeof(WCHAR))))
1059 memcpy(statstg->pwcsName, stream->u.file.path, (len + 1) * sizeof(WCHAR));
1060 }
1061 statstg->type = 0;
1062 statstg->cbSize.u.LowPart = fi.nFileSizeLow;
1063 statstg->cbSize.u.HighPart = fi.nFileSizeHigh;
1064 statstg->mtime = fi.ftLastWriteTime;
1065 statstg->ctime = fi.ftCreationTime;
1066 statstg->atime = fi.ftLastAccessTime;
1067 statstg->grfMode = stream->u.file.mode;
1068 statstg->grfLocksSupported = 0;
1069 memcpy(&statstg->clsid, &IID_IStream, sizeof(CLSID));
1070 statstg->grfStateBits = 0;
1071 statstg->reserved = 0;
1072
1073 return S_OK;
1074}
1075
1076static const IStreamVtbl filestreamvtbl =
1077{
1092};
1093
1094/*************************************************************************
1095 * SHCreateStreamOnFileEx [SHCORE.@]
1096 */
1098 BOOL create, IStream *template, IStream **ret)
1099{
1100 DWORD access, share, creation_disposition, len;
1101 struct shstream *stream;
1102 HANDLE hFile;
1103
1104 TRACE("%s, %ld, %#lx, %d, %p, %p)\n", debugstr_w(path), mode, attributes,
1105 create, template, ret);
1106
1107 if (!path || !ret || template)
1108 return E_INVALIDARG;
1109
1110 *ret = NULL;
1111
1112 /* Access */
1113 switch (mode & 0xf)
1114 {
1115 case STGM_WRITE:
1116 case STGM_READWRITE:
1118 break;
1119 case STGM_READ:
1121 break;
1122 default:
1123 return E_INVALIDARG;
1124 }
1125
1126 /* Sharing */
1127 switch (mode & 0xf0)
1128 {
1129 case 0:
1132 break;
1134 share = FILE_SHARE_WRITE;
1135 break;
1137 share = FILE_SHARE_READ;
1138 break;
1140 share = 0;
1141 break;
1142 default:
1143 return E_INVALIDARG;
1144 }
1145
1146 switch (mode & 0xf000)
1147 {
1148 case STGM_FAILIFTHERE:
1149 creation_disposition = create ? CREATE_NEW : OPEN_EXISTING;
1150 break;
1151 case STGM_CREATE:
1152 creation_disposition = CREATE_ALWAYS;
1153 break;
1154 default:
1155 return E_INVALIDARG;
1156 }
1157
1158 hFile = CreateFileW(path, access, share, NULL, creation_disposition, attributes, 0);
1161
1162 stream = malloc(sizeof(*stream));
1164 stream->refcount = 1;
1165 stream->u.file.handle = hFile;
1166 stream->u.file.mode = mode;
1167
1168 len = lstrlenW(path);
1169 stream->u.file.path = malloc((len + 1) * sizeof(WCHAR));
1170 memcpy(stream->u.file.path, path, (len + 1) * sizeof(WCHAR));
1171
1173
1174 return S_OK;
1175}
1176
1177/*************************************************************************
1178 * SHCreateStreamOnFileW [SHCORE.@]
1179 */
1181{
1182 TRACE("%s, %#lx, %p.\n", debugstr_w(path), mode, stream);
1183
1184 if (!path || !stream)
1185 return E_INVALIDARG;
1186
1188 return E_INVALIDARG;
1189
1191}
1192
1193/*************************************************************************
1194 * SHCreateStreamOnFileA [SHCORE.@]
1195 */
1197{
1198 WCHAR *pathW;
1199 HRESULT hr;
1200 DWORD len;
1201
1202 TRACE("%s, %#lx, %p.\n", debugstr_a(path), mode, stream);
1203
1204 if (!path)
1206
1207 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
1208 pathW = malloc(len * sizeof(WCHAR));
1209 if (!pathW)
1210 return E_OUTOFMEMORY;
1211
1214 free(pathW);
1215
1216 return hr;
1217}
1218
1220{
1221 struct shstream *stream = impl_from_IStream(iface);
1223
1224 TRACE("%p, refcount %lu.\n", iface, refcount);
1225
1226 if (!refcount)
1227 {
1228 if (stream->u.mem.hkey)
1229 {
1230 if (stream->u.mem.length)
1231 RegSetValueExW(stream->u.mem.hkey, stream->u.mem.valuename, 0, REG_BINARY,
1232 (const BYTE *)stream->u.mem.buffer, stream->u.mem.length);
1233 else
1234 RegDeleteValueW(stream->u.mem.hkey, stream->u.mem.valuename);
1235 RegCloseKey(stream->u.mem.hkey);
1236 }
1237 CoTaskMemFree(stream->u.mem.valuename);
1238 free(stream->u.mem.buffer);
1239 free(stream);
1240 }
1241
1242 return refcount;
1243}
1244
1245static const IStreamVtbl regstreamvtbl =
1246{
1261};
1262
1263/*************************************************************************
1264 * SHOpenRegStream2W [SHCORE.@]
1265 */
1267{
1268 struct shstream *stream;
1269 HKEY hStrKey = NULL;
1270 BYTE *buff = NULL;
1271 DWORD length = 0;
1272 LONG ret;
1273
1274 TRACE("%p, %s, %s, %#lx.\n", hKey, debugstr_w(subkey), debugstr_w(value), mode);
1275
1276 if (mode == STGM_READ)
1277 ret = RegOpenKeyExW(hKey, subkey, 0, KEY_READ, &hStrKey);
1278 else /* in write mode we make sure the subkey exits */
1279 ret = RegCreateKeyExW(hKey, subkey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hStrKey, NULL);
1280
1281 if (ret == ERROR_SUCCESS)
1282 {
1283 if (mode == STGM_READ || mode == STGM_READWRITE)
1284 {
1285 /* read initial data */
1286 ret = RegQueryValueExW(hStrKey, value, 0, 0, 0, &length);
1287 if (ret == ERROR_SUCCESS && length)
1288 {
1289 buff = malloc(length);
1290 RegQueryValueExW(hStrKey, value, 0, 0, buff, &length);
1291 }
1292 }
1293
1294 if (!length)
1295 buff = malloc(length);
1296
1298 free(buff);
1299 if (stream)
1300 {
1301 stream->u.mem.hkey = hStrKey;
1302 SHStrDupW(value, &stream->u.mem.valuename);
1303 return &stream->IStream_iface;
1304 }
1305 }
1306
1307 if (hStrKey)
1308 RegCloseKey(hStrKey);
1309
1310 return NULL;
1311}
1312
1313/*************************************************************************
1314 * SHOpenRegStream2A [SHCORE.@]
1315 */
1316IStream * WINAPI SHOpenRegStream2A(HKEY hKey, const char *subkey, const char *value, DWORD mode)
1317{
1318 WCHAR *subkeyW = NULL, *valueW = NULL;
1319 IStream *stream;
1320
1321 TRACE("%p, %s, %s, %#lx.\n", hKey, debugstr_a(subkey), debugstr_a(value), mode);
1322
1323 if (subkey && FAILED(SHStrDupA(subkey, &subkeyW)))
1324 return NULL;
1325 if (value && FAILED(SHStrDupA(value, &valueW)))
1326 {
1327 CoTaskMemFree(subkeyW);
1328 return NULL;
1329 }
1330
1331 stream = SHOpenRegStream2W(hKey, subkeyW, valueW, mode);
1332 CoTaskMemFree(subkeyW);
1334 return stream;
1335}
1336
1337/*************************************************************************
1338 * SHOpenRegStreamA [SHCORE.@]
1339 */
1340IStream * WINAPI SHOpenRegStreamA(HKEY hkey, const char *subkey, const char *value, DWORD mode)
1341{
1342 WCHAR *subkeyW = NULL, *valueW = NULL;
1343 IStream *stream;
1344
1345 TRACE("%p, %s, %s, %#lx.\n", hkey, debugstr_a(subkey), debugstr_a(value), mode);
1346
1347 if (subkey && FAILED(SHStrDupA(subkey, &subkeyW)))
1348 return NULL;
1349 if (value && FAILED(SHStrDupA(value, &valueW)))
1350 {
1351 CoTaskMemFree(subkeyW);
1352 return NULL;
1353 }
1354
1355 stream = SHOpenRegStreamW(hkey, subkeyW, valueW, mode);
1356 CoTaskMemFree(subkeyW);
1358 return stream;
1359}
1360
1362{
1363 TRACE("()\n");
1364 return 2;
1365}
1366
1368{
1369 TRACE("()\n");
1370 return 1;
1371}
1372
1373static HRESULT WINAPI dummystream_Read(IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
1374{
1375 if (read_len)
1376 *read_len = 0;
1377
1378 return E_NOTIMPL;
1379}
1380
1381static const IStreamVtbl dummystreamvtbl =
1382{
1397};
1398
1399static struct shstream dummyregstream = { { &dummystreamvtbl } };
1400
1401/*************************************************************************
1402 * SHOpenRegStreamW [SHCORE.@]
1403 */
1405{
1406 IStream *stream;
1407
1408 TRACE("%p, %s, %s, %#lx.\n", hkey, debugstr_w(subkey), debugstr_w(value), mode);
1409 stream = SHOpenRegStream2W(hkey, subkey, value, mode);
1410 return stream ? stream : &dummyregstream.IStream_iface;
1411}
1412
1414{
1417};
1418
1420{
1421 return CONTAINING_RECORD(iface, struct threadref, IUnknown_iface);
1422}
1423
1425{
1427
1428 TRACE("(%p, %s, %p)\n", threadref, debugstr_guid(riid), out);
1429
1430 if (out == NULL)
1431 return E_POINTER;
1432
1434 {
1435 *out = iface;
1436 IUnknown_AddRef(iface);
1437 return S_OK;
1438 }
1439
1440 *out = NULL;
1441 WARN("Interface %s not supported.\n", debugstr_guid(riid));
1442 return E_NOINTERFACE;
1443}
1444
1446{
1449
1450 TRACE("%p, refcount %ld.\n", threadref, refcount);
1451
1452 return refcount;
1453}
1454
1456{
1459
1460 TRACE("%p, refcount %ld.\n", threadref, refcount);
1461
1462 if (!refcount)
1463 free(threadref);
1464
1465 return refcount;
1466}
1467
1468static const IUnknownVtbl threadrefvtbl =
1469{
1473};
1474
1475/*************************************************************************
1476 * SHCreateThreadRef [SHCORE.@]
1477 */
1479{
1480 struct threadref *threadref;
1481
1482 TRACE("(%p, %p)\n", refcount, out);
1483
1484 if (!refcount || !out)
1485 return E_INVALIDARG;
1486
1487 *out = NULL;
1488
1489 threadref = malloc(sizeof(*threadref));
1490 if (!threadref)
1491 return E_OUTOFMEMORY;
1494
1495 *refcount = 1;
1497
1498 TRACE("Created %p.\n", threadref);
1499 return S_OK;
1500}
1501
1502/*************************************************************************
1503 * SHGetThreadRef [SHCORE.@]
1504 */
1506{
1507 TRACE("(%p)\n", out);
1508
1510 return E_NOINTERFACE;
1511
1513 if (!*out)
1514 return E_NOINTERFACE;
1515
1516 IUnknown_AddRef(*out);
1517 return S_OK;
1518}
1519
1520/*************************************************************************
1521 * SHSetThreadRef [SHCORE.@]
1522 */
1524{
1525 TRACE("(%p)\n", obj);
1526
1528 return E_NOINTERFACE;
1529
1531 return S_OK;
1532}
1533
1534/*************************************************************************
1535 * SHReleaseThreadRef [SHCORE.@]
1536 */
1538{
1539 FIXME("() - stub!\n");
1540 return S_OK;
1541}
1542
1543/*************************************************************************
1544 * GetProcessReference [SHCORE.@]
1545 */
1547{
1548 TRACE("(%p)\n", obj);
1549
1550 *obj = process_ref;
1551
1552 if (!process_ref)
1553 return E_FAIL;
1554
1555 if (*obj)
1556 IUnknown_AddRef(*obj);
1557
1558 return S_OK;
1559}
1560
1561/*************************************************************************
1562 * SetProcessReference [SHCORE.@]
1563 */
1565{
1566 TRACE("(%p)\n", obj);
1567
1568 process_ref = obj;
1569}
1570
1571struct thread_data
1572{
1575 void *data;
1580};
1581
1583{
1584 struct thread_data thread_data;
1585 HRESULT hr = E_FAIL;
1586 DWORD retval;
1587
1588 TRACE("(%p)\n", data);
1589
1590 /* We are now executing in the context of the newly created thread.
1591 * So we copy the data passed to us (it is on the stack of the function
1592 * that called us, which is waiting for us to signal an event before
1593 * returning). */
1594 thread_data = *(struct thread_data *)data;
1595
1597 {
1599 if (FAILED(hr))
1601 }
1602
1605
1606 /* Signal the thread that created us; it can return now. */
1608
1609 /* Execute the callers start code. */
1611
1612 /* Release thread and process references. */
1614 IUnknown_Release(thread_data.thread_ref);
1615
1617 IUnknown_Release(thread_data.process_ref);
1618
1619 if (SUCCEEDED(hr))
1621
1622 return retval;
1623}
1624
1625/*************************************************************************
1626 * SHCreateThread [SHCORE.@]
1627 */
1629{
1630 struct thread_data thread_data;
1631 BOOL called = FALSE;
1632
1633 TRACE("%p, %p, %#lx, %p.\n", thread_proc, data, flags, callback);
1634
1640
1641 if (flags & CTF_THREAD_REF)
1643 else
1645
1646 if (flags & CTF_PROCESS_REF)
1648 else
1650
1651 /* Create the thread */
1652 if (thread_data.hEvent)
1653 {
1655 DWORD retval;
1656
1658 if (hThread)
1659 {
1660 /* Wait for the thread to signal us to continue */
1663 called = TRUE;
1664 }
1666 }
1667
1668 if (!called)
1669 {
1671 {
1672 /* Couldn't call, call synchronously */
1674 called = TRUE;
1675 }
1676 else
1677 {
1679 IUnknown_Release(thread_data.thread_ref);
1680
1682 IUnknown_Release(thread_data.process_ref);
1683 }
1684 }
1685
1686 return called;
1687}
1688
1689/*************************************************************************
1690 * SHStrDupW [SHCORE.@]
1691 */
1693{
1694 size_t len;
1695
1696 TRACE("(%s, %p)\n", debugstr_w(src), dest);
1697
1698 *dest = NULL;
1699
1700 if (!src)
1701 return E_INVALIDARG;
1702
1703 len = (lstrlenW(src) + 1) * sizeof(WCHAR);
1705 if (!*dest)
1706 return E_OUTOFMEMORY;
1707
1708 memcpy(*dest, src, len);
1709
1710 return S_OK;
1711}
1712
1713/*************************************************************************
1714 * SHStrDupA [SHCORE.@]
1715 */
1717{
1718 DWORD len;
1719
1720 *dest = NULL;
1721
1722 if (!src)
1723 return E_INVALIDARG;
1724
1725 len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
1726 *dest = CoTaskMemAlloc(len * sizeof(WCHAR));
1727 if (!*dest)
1728 return E_OUTOFMEMORY;
1729
1731
1732 return S_OK;
1733}
1734
1735/*************************************************************************
1736 * SHAnsiToAnsi [SHCORE.@]
1737 */
1738DWORD WINAPI SHAnsiToAnsi(const char *src, char *dest, int dest_len)
1739{
1740 DWORD ret;
1741
1742 TRACE("(%s, %p, %d)\n", debugstr_a(src), dest, dest_len);
1743
1744 if (!src || !dest || dest_len <= 0)
1745 return 0;
1746
1747 lstrcpynA(dest, src, dest_len);
1748 ret = strlen(dest);
1749
1750 return src[ret] ? 0 : ret + 1;
1751}
1752
1753/*************************************************************************
1754 * SHUnicodeToAnsi [SHCORE.@]
1755 */
1756DWORD WINAPI SHUnicodeToAnsi(const WCHAR *src, char *dest, int dest_len)
1757{
1758 int ret = 1;
1759
1760 TRACE("(%s, %p, %d)\n", debugstr_w(src), dest, dest_len);
1761
1762 if (!dest || !dest_len)
1763 return 0;
1764
1765 if (src)
1766 {
1767 ret = WideCharToMultiByte(CP_ACP, 0, src, -1, dest, dest_len, NULL, NULL);
1768 if (!ret)
1769 {
1770 dest[dest_len - 1] = 0;
1771 ret = dest_len;
1772 }
1773 }
1774 else
1775 dest[0] = 0;
1776
1777 return ret;
1778}
1779
1780/*************************************************************************
1781 * SHUnicodeToUnicode [SHCORE.@]
1782 */
1784{
1785 DWORD ret;
1786
1787 TRACE("(%s, %p, %d)\n", debugstr_w(src), dest, dest_len);
1788
1789 if (!src || !dest || dest_len <= 0)
1790 return 0;
1791
1792 lstrcpynW(dest, src, dest_len);
1793 ret = lstrlenW(dest);
1794
1795 return src[ret] ? 0 : ret + 1;
1796}
1797
1798/*************************************************************************
1799 * SHAnsiToUnicode [SHCORE.@]
1800 */
1801DWORD WINAPI SHAnsiToUnicode(const char *src, WCHAR *dest, int dest_len)
1802{
1803 int ret = 1;
1804
1805 TRACE("(%s, %p, %d)\n", debugstr_a(src), dest, dest_len);
1806
1807 if (!dest || !dest_len)
1808 return 0;
1809
1810 if (src)
1811 {
1812 ret = MultiByteToWideChar(CP_ACP, 0, src, -1, dest, dest_len);
1813 if (!ret)
1814 {
1815 dest[dest_len - 1] = 0;
1816 ret = dest_len;
1817 }
1818 }
1819 else
1820 dest[0] = 0;
1821
1822 return ret;
1823}
1824
1825/*************************************************************************
1826 * SHRegDuplicateHKey [SHCORE.@]
1827 */
1829{
1830 HKEY newKey = 0;
1831
1832 RegOpenKeyExW(hKey, 0, 0, MAXIMUM_ALLOWED, &newKey);
1833 TRACE("new key is %p\n", newKey);
1834 return newKey;
1835}
1836
1837/*************************************************************************
1838 * SHDeleteEmptyKeyW [SHCORE.@]
1839 */
1841{
1842 DWORD ret, count = 0;
1843 HKEY hsubkey = 0;
1844
1845 TRACE("(%p, %s)\n", hkey, debugstr_w(subkey));
1846
1847 ret = RegOpenKeyExW(hkey, subkey, 0, KEY_READ, &hsubkey);
1848 if (!ret)
1849 {
1850 ret = RegQueryInfoKeyW(hsubkey, NULL, NULL, NULL, &count,
1851 NULL, NULL, NULL, NULL, NULL, NULL, NULL);
1852 RegCloseKey(hsubkey);
1853 if (!ret)
1854 {
1855 if (count)
1857 else
1858 ret = RegDeleteKeyW(hkey, subkey);
1859 }
1860 }
1861
1862 return ret;
1863}
1864
1865/*************************************************************************
1866 * SHDeleteEmptyKeyA [SHCORE.@]
1867 */
1868DWORD WINAPI SHDeleteEmptyKeyA(HKEY hkey, const char *subkey)
1869{
1870 WCHAR *subkeyW = NULL;
1871 DWORD ret;
1872
1873 TRACE("(%p, %s)\n", hkey, debugstr_a(subkey));
1874
1875 if (subkey && FAILED(SHStrDupA(subkey, &subkeyW)))
1876 return ERROR_OUTOFMEMORY;
1877
1878 ret = SHDeleteEmptyKeyW(hkey, subkeyW);
1879 CoTaskMemFree(subkeyW);
1880 return ret;
1881}
1882
1883/*************************************************************************
1884 * SHDeleteKeyW [SHCORE.@]
1885 */
1886DWORD WINAPI SHDeleteKeyW(HKEY hkey, const WCHAR *subkey)
1887{
1888 TRACE("(%p, %s)\n", hkey, debugstr_w(subkey));
1889
1890 return RegDeleteTreeW(hkey, subkey);
1891}
1892
1893/*************************************************************************
1894 * SHDeleteKeyA [SHCORE.@]
1895 */
1896DWORD WINAPI SHDeleteKeyA(HKEY hkey, const char *subkey)
1897{
1898 TRACE("(%p, %s)\n", hkey, debugstr_a(subkey));
1899
1900 return RegDeleteTreeA(hkey, subkey);
1901}
1902
1903/*************************************************************************
1904 * SHDeleteValueW [SHCORE.@]
1905 */
1906DWORD WINAPI SHDeleteValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value)
1907{
1908 HKEY hsubkey;
1909 DWORD ret;
1910
1911 TRACE("(%p, %s, %s)\n", hkey, debugstr_w(subkey), debugstr_w(value));
1912
1913 ret = RegOpenKeyExW(hkey, subkey, 0, KEY_SET_VALUE, &hsubkey);
1914 if (!ret)
1915 {
1916 ret = RegDeleteValueW(hsubkey, value);
1917 RegCloseKey(hsubkey);
1918 }
1919
1920 return ret;
1921}
1922
1923/*************************************************************************
1924 * SHDeleteValueA [SHCORE.@]
1925 */
1926DWORD WINAPI SHDeleteValueA(HKEY hkey, const char *subkey, const char *value)
1927{
1928 WCHAR *subkeyW = NULL, *valueW = NULL;
1929 DWORD ret;
1930
1931 TRACE("(%p, %s, %s)\n", hkey, debugstr_a(subkey), debugstr_a(value));
1932
1933 if (subkey && FAILED(SHStrDupA(subkey, &subkeyW)))
1934 return ERROR_OUTOFMEMORY;
1935 if (value && FAILED(SHStrDupA(value, &valueW)))
1936 {
1937 CoTaskMemFree(subkeyW);
1938 return ERROR_OUTOFMEMORY;
1939 }
1940
1941 ret = SHDeleteValueW(hkey, subkeyW, valueW);
1942 CoTaskMemFree(subkeyW);
1944 return ret;
1945}
1946
1947/*************************************************************************
1948 * SHCopyKeyA [SHCORE.@]
1949 */
1950DWORD WINAPI SHCopyKeyA(HKEY hkey_src, const char *subkey, HKEY hkey_dst, DWORD reserved)
1951{
1952 WCHAR *subkeyW = NULL;
1953 DWORD ret;
1954
1955 TRACE("%p, %s, %p, %ld.\n", hkey_src, debugstr_a(subkey), hkey_dst, reserved);
1956
1957 if (subkey && FAILED(SHStrDupA(subkey, &subkeyW)))
1958 return 0;
1959
1960 ret = SHCopyKeyW(hkey_src, subkeyW, hkey_dst, reserved);
1961 CoTaskMemFree(subkeyW);
1962 return ret;
1963}
1964
1965/*************************************************************************
1966 * SHCopyKeyW [SHCORE.@]
1967 */
1968DWORD WINAPI SHCopyKeyW(HKEY hkey_src, const WCHAR *subkey, HKEY hkey_dst, DWORD reserved)
1969{
1970 DWORD key_count = 0, value_count = 0, max_key_len = 0;
1971 WCHAR name[MAX_PATH], *ptr_name = name;
1972 BYTE buff[1024], *ptr = buff;
1973 DWORD max_data_len = 0, i;
1974 DWORD ret = 0;
1975
1976 TRACE("%p, %s, %p, %ld.\n", hkey_src, debugstr_w(subkey), hkey_dst, reserved);
1977
1978 if (!hkey_dst || !hkey_src)
1980
1981 if (subkey)
1982 ret = RegOpenKeyExW(hkey_src, subkey, 0, KEY_ALL_ACCESS, &hkey_src);
1983
1984 if (ret)
1985 hkey_src = NULL; /* Don't close this key since we didn't open it */
1986 else
1987 {
1988 DWORD max_value_len;
1989
1990 ret = RegQueryInfoKeyW(hkey_src, NULL, NULL, NULL, &key_count, &max_key_len,
1991 NULL, &value_count, &max_value_len, &max_data_len, NULL, NULL);
1992 if (!ret)
1993 {
1994 /* Get max size for key/value names */
1995 max_key_len = max(max_key_len, max_value_len);
1996
1997 if (max_key_len++ > MAX_PATH - 1)
1998 ptr_name = malloc(max_key_len * sizeof(WCHAR));
1999
2000 if (max_data_len > sizeof(buff))
2001 ptr = malloc(max_data_len);
2002
2003 if (!ptr_name || !ptr)
2005 }
2006 }
2007
2008 for (i = 0; i < key_count && !ret; i++)
2009 {
2010 HKEY hsubkey_src, hsubkey_dst;
2011 DWORD length = max_key_len;
2012
2013 ret = RegEnumKeyExW(hkey_src, i, ptr_name, &length, NULL, NULL, NULL, NULL);
2014 if (!ret)
2015 {
2016 ret = RegOpenKeyExW(hkey_src, ptr_name, 0, KEY_READ, &hsubkey_src);
2017 if (!ret)
2018 {
2019 /* Create destination sub key */
2020 ret = RegCreateKeyW(hkey_dst, ptr_name, &hsubkey_dst);
2021 if (!ret)
2022 {
2023 /* Recursively copy keys and values from the sub key */
2024 ret = SHCopyKeyW(hsubkey_src, NULL, hsubkey_dst, 0);
2025 RegCloseKey(hsubkey_dst);
2026 }
2027 }
2028 RegCloseKey(hsubkey_src);
2029 }
2030 }
2031
2032 /* Copy all the values in this key */
2033 for (i = 0; i < value_count && !ret; i++)
2034 {
2035 DWORD length = max_key_len, type, data_len = max_data_len;
2036
2037 ret = RegEnumValueW(hkey_src, i, ptr_name, &length, NULL, &type, ptr, &data_len);
2038 if (!ret) {
2039 ret = SHSetValueW(hkey_dst, NULL, ptr_name, type, ptr, data_len);
2040 }
2041 }
2042
2043 /* Free buffers if allocated */
2044 if (ptr_name != name)
2045 free(ptr_name);
2046 if (ptr != buff)
2047 free(ptr);
2048
2049 if (subkey && hkey_src)
2050 RegCloseKey(hkey_src);
2051
2052 return ret;
2053}
2054
2055
2056/*************************************************************************
2057 * SHEnumKeyExA [SHCORE.@]
2058 */
2060{
2061 TRACE("%p, %ld, %s, %p.\n", hkey, index, debugstr_a(subkey), length);
2062
2063 return RegEnumKeyExA(hkey, index, subkey, length, NULL, NULL, NULL, NULL);
2064}
2065
2066/*************************************************************************
2067 * SHEnumKeyExW [SHCORE.@]
2068 */
2070{
2071 TRACE("%p, %ld, %s, %p.\n", hkey, index, debugstr_w(subkey), length);
2072
2073 return RegEnumKeyExW(hkey, index, subkey, length, NULL, NULL, NULL, NULL);
2074}
2075
2076/*************************************************************************
2077 * SHEnumValueA [SHCORE.@]
2078 */
2080 void *data, DWORD *data_len)
2081{
2082 TRACE("%p, %ld, %s, %p, %p, %p, %p.\n", hkey, index, debugstr_a(value), length, type, data, data_len);
2083
2084 return RegEnumValueA(hkey, index, value, length, NULL, type, data, data_len);
2085}
2086
2087/*************************************************************************
2088 * SHEnumValueW [SHCORE.@]
2089 */
2091 void *data, DWORD *data_len)
2092{
2093 TRACE("%p, %ld, %s, %p, %p, %p, %p.\n", hkey, index, debugstr_w(value), length, type, data, data_len);
2094
2095 return RegEnumValueW(hkey, index, value, length, NULL, type, data, data_len);
2096}
2097
2098/*************************************************************************
2099 * SHQueryValueExW [SHCORE.@]
2100 */
2102 void *buff, DWORD *buff_len)
2103{
2104 DWORD ret, value_type, data_len = 0;
2105
2106 TRACE("(%p, %s, %p, %p, %p, %p)\n", hkey, debugstr_w(name), reserved, type, buff, buff_len);
2107
2108 if (buff_len)
2109 data_len = *buff_len;
2110
2111 ret = RegQueryValueExW(hkey, name, reserved, &value_type, buff, &data_len);
2112 if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA)
2113 return ret;
2114
2115 if (buff_len && value_type == REG_EXPAND_SZ)
2116 {
2117 DWORD length;
2118 WCHAR *value;
2119
2120 if (!buff || ret == ERROR_MORE_DATA)
2121 {
2122 length = data_len;
2123 value = malloc(length);
2126 }
2127 else
2128 {
2129 length = (lstrlenW(buff) + 1) * sizeof(WCHAR);
2130 value = malloc(length);
2134 }
2135 data_len = max(data_len, length);
2136 free(value);
2137 }
2138
2139 if (type)
2140 *type = value_type == REG_EXPAND_SZ ? REG_SZ : value_type;
2141 if (buff_len)
2142 *buff_len = data_len;
2143 return ret;
2144}
2145
2146/*************************************************************************
2147 * SHQueryValueExA [SHCORE.@]
2148 */
2150 void *buff, DWORD *buff_len)
2151{
2152 DWORD ret, value_type, data_len = 0;
2153
2154 TRACE("(%p, %s, %p, %p, %p, %p)\n", hkey, debugstr_a(name), reserved, type, buff, buff_len);
2155
2156 if (buff_len)
2157 data_len = *buff_len;
2158
2159 ret = RegQueryValueExA(hkey, name, reserved, &value_type, buff, &data_len);
2160 if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA)
2161 return ret;
2162
2163 if (buff_len && value_type == REG_EXPAND_SZ)
2164 {
2165 DWORD length;
2166 char *value;
2167
2168 if (!buff || ret == ERROR_MORE_DATA)
2169 {
2170 length = data_len;
2171 value = malloc(length);
2174 }
2175 else
2176 {
2177 length = strlen(buff) + 1;
2178 value = malloc(length);
2182 }
2183 data_len = max(data_len, length);
2184 free(value);
2185 }
2186
2187 if (type)
2188 *type = value_type == REG_EXPAND_SZ ? REG_SZ : value_type;
2189 if (buff_len)
2190 *buff_len = data_len;
2191 return ret;
2192}
2193
2194/*************************************************************************
2195 * SHGetValueA [SHCORE.@]
2196 */
2197DWORD WINAPI SHGetValueA(HKEY hkey, const char *subkey, const char *value,
2198 DWORD *type, void *data, DWORD *data_len)
2199{
2200 HKEY hsubkey = 0;
2201 DWORD ret = 0;
2202
2203 TRACE("(%p, %s, %s, %p, %p, %p)\n", hkey, debugstr_a(subkey), debugstr_a(value),
2204 type, data, data_len);
2205
2206 if (subkey)
2207 ret = RegOpenKeyExA(hkey, subkey, 0, KEY_QUERY_VALUE, &hsubkey);
2208
2209 if (!ret)
2210 {
2211 ret = SHQueryValueExA(hsubkey ? hsubkey : hkey, value, 0, type, data, data_len);
2212 if (subkey)
2213 RegCloseKey(hsubkey);
2214 }
2215
2216 return ret;
2217}
2218
2219/*************************************************************************
2220 * SHGetValueW [SHCORE.@]
2221 */
2222DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value,
2223 DWORD *type, void *data, DWORD *data_len)
2224{
2225 HKEY hsubkey = 0;
2226 DWORD ret = 0;
2227
2228 TRACE("(%p, %s, %s, %p, %p, %p)\n", hkey, debugstr_w(subkey), debugstr_w(value),
2229 type, data, data_len);
2230
2231 if (subkey)
2232 ret = RegOpenKeyExW(hkey, subkey, 0, KEY_QUERY_VALUE, &hsubkey);
2233
2234 if (!ret)
2235 {
2236 ret = SHQueryValueExW(hsubkey ? hsubkey : hkey, value, 0, type, data, data_len);
2237 if (subkey)
2238 RegCloseKey(hsubkey);
2239 }
2240
2241 return ret;
2242}
2243
2244/*************************************************************************
2245 * SHRegGetIntW [SHCORE.280]
2246 */
2247int WINAPI SHRegGetIntW(HKEY hkey, const WCHAR *value, int default_value)
2248{
2249 WCHAR buff[32];
2251
2252 TRACE("(%p, %s, %d)\n", hkey, debugstr_w(value), default_value);
2253
2254 buff[0] = 0;
2255 buff_len = sizeof(buff);
2256 if (SHQueryValueExW(hkey, value, 0, 0, buff, &buff_len))
2257 return default_value;
2258
2259 if (*buff >= '0' && *buff <= '9')
2260 return wcstol(buff, NULL, 10);
2261
2262 return default_value;
2263}
2264
2265/*************************************************************************
2266 * SHRegGetPathA [SHCORE.@]
2267 */
2268DWORD WINAPI SHRegGetPathA(HKEY hkey, const char *subkey, const char *value, char *path, DWORD flags)
2269{
2271
2272 TRACE("%p, %s, %s, %p, %#lx.\n", hkey, debugstr_a(subkey), debugstr_a(value), path, flags);
2273
2274 return SHGetValueA(hkey, subkey, value, 0, path, &length);
2275}
2276
2277/*************************************************************************
2278 * SHRegGetPathW [SHCORE.@]
2279 */
2281{
2283
2284 TRACE("%p, %s, %s, %p, %#lx.\n", hkey, debugstr_w(subkey), debugstr_w(value), path, flags);
2285
2286 return SHGetValueW(hkey, subkey, value, 0, path, &length);
2287}
2288
2289/*************************************************************************
2290 * SHSetValueW [SHCORE.@]
2291 */
2292DWORD WINAPI SHSetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD type,
2293 const void *data, DWORD data_len)
2294{
2296 HKEY hsubkey;
2297
2298 TRACE("%p, %s, %s, %ld, %p, %ld.\n", hkey, debugstr_w(subkey), debugstr_w(value),
2299 type, data, data_len);
2300
2301 if (subkey && *subkey)
2302 ret = RegCreateKeyExW(hkey, subkey, 0, NULL, 0, KEY_SET_VALUE, NULL, &hsubkey, &dummy);
2303 else
2304 hsubkey = hkey;
2305
2306 if (!ret)
2307 {
2308 ret = RegSetValueExW(hsubkey, value, 0, type, data, data_len);
2309 if (hsubkey != hkey)
2310 RegCloseKey(hsubkey);
2311 }
2312
2313 return ret;
2314}
2315
2316/*************************************************************************
2317 * SHSetValueA [SHCORE.@]
2318 */
2319DWORD WINAPI SHSetValueA(HKEY hkey, const char *subkey, const char *value,
2320 DWORD type, const void *data, DWORD data_len)
2321{
2323 HKEY hsubkey;
2324
2325 TRACE("%p, %s, %s, %ld, %p, %ld.\n", hkey, debugstr_a(subkey), debugstr_a(value),
2326 type, data, data_len);
2327
2328 if (subkey && *subkey)
2329 ret = RegCreateKeyExA(hkey, subkey, 0, NULL, 0, KEY_SET_VALUE, NULL, &hsubkey, &dummy);
2330 else
2331 hsubkey = hkey;
2332
2333 if (!ret)
2334 {
2335 ret = RegSetValueExA(hsubkey, value, 0, type, data, data_len);
2336 if (hsubkey != hkey)
2337 RegCloseKey(hsubkey);
2338 }
2339
2340 return ret;
2341}
2342
2343/*************************************************************************
2344 * SHRegSetPathA [SHCORE.@]
2345 */
2346DWORD WINAPI SHRegSetPathA(HKEY hkey, const char *subkey, const char *value, const char *path, DWORD flags)
2347{
2348 FIXME("%p, %s, %s, %s, %#lx - semi-stub\n", hkey, debugstr_a(subkey),
2350
2351 /* FIXME: PathUnExpandEnvStringsA() */
2352
2353 return SHSetValueA(hkey, subkey, value, REG_SZ, path, lstrlenA(path));
2354}
2355
2356/*************************************************************************
2357 * SHRegSetPathW [SHCORE.@]
2358 */
2359DWORD WINAPI SHRegSetPathW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, const WCHAR *path, DWORD flags)
2360{
2361 FIXME("%p, %s, %s, %s, %#lx semi-stub\n", hkey, debugstr_w(subkey),
2363
2364 /* FIXME: PathUnExpandEnvStringsW(); */
2365
2366 return SHSetValueW(hkey, subkey, value, REG_SZ, path, lstrlenW(path));
2367}
2368
2369/*************************************************************************
2370 * SHQueryInfoKeyA [SHCORE.@]
2371 */
2372LONG WINAPI SHQueryInfoKeyA(HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max)
2373{
2374 TRACE("(%p, %p, %p, %p, %p)\n", hkey, subkeys, subkey_max, values, value_max);
2375
2376 return RegQueryInfoKeyA(hkey, NULL, NULL, NULL, subkeys, subkey_max, NULL, values, value_max, NULL, NULL, NULL);
2377}
2378
2379/*************************************************************************
2380 * SHQueryInfoKeyW [SHCORE.@]
2381 */
2382LONG WINAPI SHQueryInfoKeyW(HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max)
2383{
2384 TRACE("(%p, %p, %p, %p, %p)\n", hkey, subkeys, subkey_max, values, value_max);
2385
2386 return RegQueryInfoKeyW(hkey, NULL, NULL, NULL, subkeys, subkey_max, NULL, values, value_max, NULL, NULL, NULL);
2387}
2388
2389/*************************************************************************
2390 * IsOS [SHCORE.@]
2391 */
2393{
2394 DWORD platform, majorv, minorv;
2395#ifdef __REACTOS__
2397
2398 osvi.dwOSVersionInfoSize = sizeof(osvi);
2400 {
2403 {
2404 ERR("GetVersionEx failed\n");
2405 return FALSE;
2406 }
2407 osvi.wProductType = VER_NT_WORKSTATION;
2408 osvi.wSuiteMask = 0;
2409 }
2410#else
2412
2414 if (!GetVersionExA(&osvi))
2415 return FALSE;
2416#endif
2417
2418 majorv = osvi.dwMajorVersion;
2419 minorv = osvi.dwMinorVersion;
2421
2422#define ISOS_RETURN(x) \
2423 TRACE("(%#lx) ret %d\n",feature,(x)); \
2424 return (x)
2425
2426 switch(feature) {
2427 case OS_WIN32SORGREATER:
2430 case OS_NT:
2432 case OS_WIN95ORGREATER:
2434 case OS_NT4ORGREATER:
2435 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 4);
2438 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5);
2439 case OS_WIN98ORGREATER:
2441 case OS_WIN98_GOLD:
2443 case OS_WIN2000PRO:
2444 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5);
2445 case OS_WIN2000SERVER:
2446 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1));
2448 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1));
2450 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1));
2451 case OS_WIN2000TERMINAL:
2452 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1));
2453 case OS_EMBEDDED:
2454 FIXME("(OS_EMBEDDED) What should we return here?\n");
2455 return FALSE;
2456 case OS_TERMINALCLIENT:
2457 FIXME("(OS_TERMINALCLIENT) What should we return here?\n");
2458 return FALSE;
2460 FIXME("(OS_TERMINALREMOTEADMIN) What should we return here?\n");
2461 return FALSE;
2462 case OS_WIN95_GOLD:
2464 case OS_MEORGREATER:
2466 case OS_XPORGREATER:
2467 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1);
2468 case OS_HOME:
2469 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1);
2470 case OS_PROFESSIONAL:
2472 case OS_DATACENTER:
2474 case OS_ADVSERVER:
2475 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5);
2476 case OS_SERVER:
2478 case OS_TERMINALSERVER:
2481 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && minorv >= 1 && majorv >= 5);
2483 FIXME("(OS_FASTUSERSWITCHING) What should we return here?\n");
2484 return TRUE;
2485 case OS_WELCOMELOGONUI:
2486 FIXME("(OS_WELCOMELOGONUI) What should we return here?\n");
2487 return FALSE;
2488 case OS_DOMAINMEMBER:
2489 FIXME("(OS_DOMAINMEMBER) What should we return here?\n");
2490 return TRUE;
2491 case OS_ANYSERVER:
2492#ifdef __REACTOS__
2493 ISOS_RETURN(osvi.wProductType > VER_NT_WORKSTATION);
2494#else
2496#endif
2497 case OS_WOW6432:
2498 {
2499 BOOL is_wow64;
2501 return is_wow64;
2502 }
2503 case OS_WEBSERVER:
2507 case OS_TABLETPC:
2508 FIXME("(OS_TABLETPC) What should we return here?\n");
2509 return FALSE;
2510 case OS_SERVERADMINUI:
2511#ifdef __REACTOS__
2512 {
2513 DWORD value = FALSE, size = sizeof(value);
2514 HKEY hKey = NULL;
2515
2518 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
2519 0,
2521 &hKey);
2522
2523 if (hKey)
2524 {
2525 SHQueryValueExW(hKey, L"ServerAdminUI", NULL, NULL, &value, &size);
2527 }
2529 }
2530#else
2531 FIXME("(OS_SERVERADMINUI) What should we return here?\n");
2532 return FALSE;
2533#endif
2534 case OS_MEDIACENTER:
2535 FIXME("(OS_MEDIACENTER) What should we return here?\n");
2536 return FALSE;
2537 case OS_APPLIANCE:
2538 FIXME("(OS_APPLIANCE) What should we return here?\n");
2539 return FALSE;
2540 case 0x25: /*OS_VISTAORGREATER*/
2541 ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 6);
2542 }
2543
2544#undef ISOS_RETURN
2545
2546 WARN("(%#lx) unknown parameter\n", feature);
2547
2548 return FALSE;
2549}
2550
2551/*************************************************************************
2552 * SubscribeFeatureStateChangeNotification [SHCORE.@]
2553 */
2554void WINAPI SubscribeFeatureStateChangeNotification(FEATURE_STATE_CHANGE_SUBSCRIPTION *subscription,
2556{
2557 FIXME("(%p, %p, %p) stub\n", subscription, callback, context);
2558}
2559
2560/*************************************************************************
2561 * GetFeatureEnabledState [SHCORE.@]
2562 */
2564{
2565 FIXME("(%u, %u) stub\n", feature, change_time);
2567}
2568
2569/*************************************************************************
2570 * RegisterScaleChangeEvent [SHCORE.@]
2571 */
2573{
2574 FIXME("(%p, %p) stub\n", handle, cookie);
2575 return E_NOTIMPL;
2576}
2577
2578/*************************************************************************
2579 * RegisterScaleChangeNotifications [SHCORE.@]
2580 */
2582{
2583 FIXME("(%d, %p, %u, %p) stub\n", display_device, hwnd, msg, cookie);
2584
2585 if (cookie) *cookie = 0;
2586
2587 return E_NOTIMPL;
2588}
2589
2590/*************************************************************************
2591 * CreateRandomAccessStreamOverStream [SHCORE.@]
2592 */
2594{
2595 FIXME("(%p, %d, %s, %p) stub\n", stream, options, debugstr_guid(riid), ppv);
2596 return E_NOTIMPL;
2597}
static DWORD WINAPI thread_proc(void *param)
#define read
Definition: acwin.h:97
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
int mode
Definition: main.c:91
BOOL NTAPI DllMain(_In_ HINSTANCE hDll, _In_ ULONG dwReason, _In_opt_ PVOID pReserved)
Definition: main.c:33
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
FT_UInt sid
Definition: cffcmap.c:138
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
device_type
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HINSTANCE instance
Definition: main.c:40
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegDeleteTreeA(IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL)
Definition: reg.c:1805
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3583
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2668
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2419
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define CloseHandle
Definition: compat.h:739
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define FILE_BEGIN
Definition: compat.h:761
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
#define lstrcpynA
Definition: compat.h:751
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define GetCurrentProcess()
Definition: compat.h:759
#define GENERIC_READ
Definition: compat.h:135
#define IsWow64Process
Definition: compat.h:760
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:372
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:442
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:988
BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
Definition: fileinfo.c:177
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1240
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1276
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
BOOL WINAPI GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation)
Definition: version.c:69
BOOL is_wow64
Definition: main.c:38
DWORD WINAPI DECLSPEC_HOTPATCH TlsAlloc(void)
Definition: thread.c:657
MonoAssembly int argc
Definition: metahost.c:107
_ACRTIMP void *__cdecl _recalloc(void *, size_t, size_t) __WINE_ALLOC_SIZE(2
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
HRESULT WINAPI SHGetThreadRef(IUnknown **out)
Definition: main.c:1505
static HRESULT WINAPI memstream_Stat(IStream *iface, STATSTG *statstg, DWORD flags)
Definition: main.c:790
HRESULT WINAPI SHReleaseThreadRef(void)
Definition: main.c:1537
static ULONG WINAPI threadref_Release(IUnknown *iface)
Definition: main.c:1455
static HRESULT WINAPI memstream_SetSize(IStream *iface, ULARGE_INTEGER new_size)
Definition: main.c:682
static HRESULT WINAPI memstream_Read(IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
Definition: main.c:600
LONG WINAPI SHEnumValueA(HKEY hkey, DWORD index, char *value, DWORD *length, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2079
void WINAPI SetProcessReference(IUnknown *obj)
Definition: main.c:1564
HRESULT WINAPI _IStream_Read(IStream *stream, void *dest, ULONG size)
Definition: main.c:98
DWORD WINAPI SHCopyKeyA(HKEY hkey_src, const char *subkey, HKEY hkey_dst, DWORD reserved)
Definition: main.c:1950
static const IStreamVtbl filestreamvtbl
Definition: main.c:1076
HRESULT WINAPI IUnknown_QueryService(IUnknown *obj, REFGUID sid, REFIID iid, void **out)
Definition: main.c:181
DWORD WINAPI SHUnicodeToUnicode(const WCHAR *src, WCHAR *dest, int dest_len)
Definition: main.c:1783
HRESULT WINAPI IStream_Reset(IStream *stream)
Definition: main.c:111
static DWORD shcore_tls
Definition: main.c:40
HRESULT WINAPI _IStream_Write(IStream *stream, const void *src, ULONG size)
Definition: main.c:136
LONG WINAPI SHEnumKeyExW(HKEY hkey, DWORD index, WCHAR *subkey, DWORD *length)
Definition: main.c:2069
static HRESULT WINAPI shstream_Commit(IStream *iface, DWORD flags)
Definition: main.c:752
HRESULT WINAPI SetCurrentProcessExplicitAppUserModelID(const WCHAR *appid)
Definition: main.c:254
static ULONG WINAPI threadref_AddRef(IUnknown *iface)
Definition: main.c:1445
static const IUnknownVtbl threadrefvtbl
Definition: main.c:1468
HRESULT WINAPI SHCreateStreamOnFileEx(const WCHAR *path, DWORD mode, DWORD attributes, BOOL create, IStream *template, IStream **ret)
Definition: main.c:1097
static ULONG WINAPI dummystream_Release(IStream *iface)
Definition: main.c:1367
static ULONG WINAPI dummystream_AddRef(IStream *iface)
Definition: main.c:1361
DWORD WINAPI SHQueryValueExW(HKEY hkey, const WCHAR *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
Definition: main.c:2101
BOOL WINAPI IsOS(DWORD feature)
Definition: main.c:2392
HRESULT WINAPI SHStrDupW(const WCHAR *src, WCHAR **dest)
Definition: main.c:1692
static struct threadref * threadref_impl_from_IUnknown(IUnknown *iface)
Definition: main.c:1419
IStream *WINAPI SHOpenRegStream2A(HKEY hKey, const char *subkey, const char *value, DWORD mode)
Definition: main.c:1316
static ULONG WINAPI memstream_Release(IStream *iface)
Definition: main.c:584
HRESULT WINAPI IStream_Size(IStream *stream, ULARGE_INTEGER *size)
Definition: main.c:120
DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2222
LONG WINAPI SHQueryInfoKeyA(HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max)
Definition: main.c:2372
static HRESULT WINAPI filestream_CopyTo(IStream *iface, IStream *dest, ULARGE_INTEGER size, ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
Definition: main.c:990
IStream *WINAPI SHOpenRegStreamW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD mode)
Definition: main.c:1404
DWORD WINAPI SHDeleteKeyA(HKEY hkey, const char *subkey)
Definition: main.c:1896
HRESULT WINAPI CreateRandomAccessStreamOverStream(IStream *stream, BSOS_OPTIONS options, REFIID riid, void **ppv)
Definition: main.c:2593
static HRESULT WINAPI filestream_Write(IStream *iface, const void *buff, ULONG size, ULONG *written)
Definition: main.c:919
DWORD WINAPI SHRegGetPathA(HKEY hkey, const char *subkey, const char *value, char *path, DWORD flags)
Definition: main.c:2268
DWORD WINAPI SHRegGetPathW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, WCHAR *path, DWORD flags)
Definition: main.c:2280
LONG WINAPI SHEnumKeyExA(HKEY hkey, DWORD index, char *subkey, DWORD *length)
Definition: main.c:2059
DWORD WINAPI SHQueryValueExA(HKEY hkey, const char *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
Definition: main.c:2149
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE thread_proc, void *data, DWORD flags, LPTHREAD_START_ROUTINE callback)
Definition: main.c:1628
static HRESULT WINAPI shstream_UnlockRegion(IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER size, DWORD lock_type)
Definition: main.c:780
static HRESULT WINAPI shstream_LockRegion(IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER size, DWORD lock_type)
Definition: main.c:770
static DWORD WINAPI shcore_thread_wrapper(void *data)
Definition: main.c:1582
DWORD WINAPI SHDeleteEmptyKeyW(HKEY hkey, const WCHAR *subkey)
Definition: main.c:1840
HRESULT WINAPI SHCreateStreamOnFileA(const char *path, DWORD mode, IStream **stream)
Definition: main.c:1196
static const IStreamVtbl memstreamvtbl
Definition: main.c:816
DWORD WINAPI SHAnsiToUnicode(const char *src, WCHAR *dest, int dest_len)
Definition: main.c:1801
static const IStreamVtbl dummystreamvtbl
Definition: main.c:1381
HRESULT WINAPI GetCurrentProcessExplicitAppUserModelID(const WCHAR **appid)
Definition: main.c:260
DWORD WINAPI SHSetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD type, const void *data, DWORD data_len)
Definition: main.c:2292
static HRESULT WINAPI filestream_Commit(IStream *iface, DWORD flags)
Definition: main.c:1033
DWORD WINAPI SHDeleteValueA(HKEY hkey, const char *subkey, const char *value)
Definition: main.c:1926
LONG WINAPI SHQueryInfoKeyW(HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max)
Definition: main.c:2382
IStream *WINAPI SHCreateMemStream(const BYTE *data, UINT data_len)
Definition: main.c:873
void WINAPI IUnknown_Set(IUnknown **dest, IUnknown *src)
Definition: main.c:209
DWORD WINAPI SHUnicodeToAnsi(const WCHAR *src, char *dest, int dest_len)
Definition: main.c:1756
static HRESULT WINAPI shstream_Revert(IStream *iface)
Definition: main.c:760
static HRESULT WINAPI memstream_Write(IStream *iface, const void *buff, ULONG buff_size, ULONG *written)
Definition: main.c:627
IStream *WINAPI SHOpenRegStreamA(HKEY hkey, const char *subkey, const char *value, DWORD mode)
Definition: main.c:1340
static HRESULT WINAPI filestream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *new_pos)
Definition: main.c:944
HRESULT WINAPI GetProcessReference(IUnknown **obj)
Definition: main.c:1546
HRESULT WINAPI IUnknown_GetSite(IUnknown *unk, REFIID iid, void **site)
Definition: main.c:161
static ULONG WINAPI regstream_Release(IStream *iface)
Definition: main.c:1219
static const IStreamVtbl regstreamvtbl
Definition: main.c:1245
HRESULT WINAPI SetProcessDpiAwareness(PROCESS_DPI_AWARENESS value)
Definition: main.c:70
HRESULT WINAPI RegisterScaleChangeNotifications(DISPLAY_DEVICE_TYPE display_device, HWND hwnd, UINT msg, DWORD *cookie)
Definition: main.c:2581
int WINAPI SHRegGetIntW(HKEY hkey, const WCHAR *value, int default_value)
Definition: main.c:2247
FEATURE_ENABLED_STATE WINAPI GetFeatureEnabledState(UINT32 feature, FEATURE_CHANGE_TIME change_time)
Definition: main.c:2563
static ULONG WINAPI filestream_Release(IStream *iface)
Definition: main.c:883
static HRESULT WINAPI filestream_Read(IStream *iface, void *buff, ULONG size, ULONG *read_len)
Definition: main.c:900
static struct shstream * shstream_create(const IStreamVtbl *vtbl, const BYTE *data, UINT data_len)
Definition: main.c:834
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey)
Definition: main.c:1828
static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, void **out)
Definition: main.c:1424
HRESULT WINAPI SHCreateStreamOnFileW(const WCHAR *path, DWORD mode, IStream **stream)
Definition: main.c:1180
HRESULT WINAPI SHCreateThreadRef(LONG *refcount, IUnknown **out)
Definition: main.c:1478
static HRESULT WINAPI memstream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *new_pos)
Definition: main.c:655
DWORD WINAPI SHDeleteValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value)
Definition: main.c:1906
static IUnknown * process_ref
Definition: main.c:41
DWORD WINAPI SHAnsiToAnsi(const char *src, char *dest, int dest_len)
Definition: main.c:1738
static struct shstream dummyregstream
Definition: main.c:1399
HRESULT WINAPI SHStrDupA(const char *src, WCHAR **dest)
Definition: main.c:1716
static struct shstream * impl_from_IStream(IStream *iface)
Definition: main.c:549
IStream *WINAPI SHOpenRegStream2W(HKEY hKey, const WCHAR *subkey, const WCHAR *value, DWORD mode)
Definition: main.c:1266
DWORD WINAPI SHDeleteKeyW(HKEY hkey, const WCHAR *subkey)
Definition: main.c:1886
HRESULT WINAPI GetDpiForMonitor(HMONITOR monitor, MONITOR_DPI_TYPE type, UINT *x, UINT *y)
Definition: main.c:76
DWORD WINAPI SHCopyKeyW(HKEY hkey_src, const WCHAR *subkey, HKEY hkey_dst, DWORD reserved)
Definition: main.c:1968
static ULONG WINAPI shstream_AddRef(IStream *iface)
Definition: main.c:574
WCHAR **WINAPI CommandLineToArgvW(const WCHAR *cmdline, int *numargs)
Definition: main.c:294
LONG WINAPI SHEnumValueW(HKEY hkey, DWORD index, WCHAR *value, DWORD *length, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2090
HRESULT WINAPI SHSetThreadRef(IUnknown *obj)
Definition: main.c:1523
DEVICE_SCALE_FACTOR WINAPI GetScaleFactorForDevice(DISPLAY_DEVICE_TYPE device_type)
Definition: main.c:91
DWORD WINAPI SHDeleteEmptyKeyA(HKEY hkey, const char *subkey)
Definition: main.c:1868
static HRESULT WINAPI shstream_Clone(IStream *iface, IStream **dest)
Definition: main.c:804
static HRESULT WINAPI filestream_SetSize(IStream *iface, ULARGE_INTEGER size)
Definition: main.c:964
static HRESULT WINAPI dummystream_Read(IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
Definition: main.c:1373
#define ISOS_RETURN(x)
DWORD WINAPI SHRegSetPathW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, const WCHAR *path, DWORD flags)
Definition: main.c:2359
static HRESULT WINAPI shstream_QueryInterface(IStream *iface, REFIID riid, void **out)
Definition: main.c:554
HRESULT WINAPI GetScaleFactorForMonitor(HMONITOR monitor, DEVICE_SCALE_FACTOR *scale)
Definition: main.c:83
void WINAPI IUnknown_AtomicRelease(IUnknown **obj)
Definition: main.c:150
DWORD WINAPI SHGetValueA(HKEY hkey, const char *subkey, const char *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2197
HRESULT WINAPI GetProcessDpiAwareness(HANDLE process, PROCESS_DPI_AWARENESS *value)
Definition: main.c:64
DWORD WINAPI SHSetValueA(HKEY hkey, const char *subkey, const char *value, DWORD type, const void *data, DWORD data_len)
Definition: main.c:2319
static HRESULT WINAPI filestream_Stat(IStream *iface, STATSTG *statstg, DWORD flags)
Definition: main.c:1040
HRESULT WINAPI RegisterScaleChangeEvent(HANDLE handle, DWORD_PTR *cookie)
Definition: main.c:2572
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: main.c:222
void WINAPI SubscribeFeatureStateChangeNotification(FEATURE_STATE_CHANGE_SUBSCRIPTION *subscription, FEATURE_STATE_CHANGE_CALLBACK *callback, void *context)
Definition: main.c:2554
static HRESULT WINAPI shstream_CopyTo(IStream *iface, IStream *dest, ULARGE_INTEGER size, ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
Definition: main.c:702
DWORD WINAPI SHRegSetPathA(HKEY hkey, const char *subkey, const char *value, const char *path, DWORD flags)
Definition: main.c:2346
BOOL WINAPI GetDpiForMonitorInternal(_In_ HMONITOR monitor, _In_ UINT type, _Out_ UINT *x, _Out_ UINT *y)
Definition: dpi.c:113
BOOL WINAPI GetProcessDpiAwarenessInternal(_In_ HANDLE process, _Out_ DPI_AWARENESS *awareness)
Definition: dpi.c:88
BOOL WINAPI SetProcessDpiAwarenessInternal(_In_ DPI_AWARENESS awareness)
Definition: dpi.c:101
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
#define INFINITE
Definition: serial.h:102
size_t const new_size
Definition: expand.cpp:66
FEATURE_ENABLED_STATE
@ FEATURE_ENABLED_STATE_DEFAULT
void WINAPI FEATURE_STATE_CHANGE_CALLBACK(void *)
FEATURE_CHANGE_TIME
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLuint index
Definition: glext.h:6031
GLenum mode
Definition: glext.h:6217
GLint left
Definition: glext.h:7726
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
voidpf uLong int origin
Definition: ioapi.h:144
#define d
Definition: ke_i.h:81
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE
Definition: minwinbase.h:124
#define LMEM_FIXED
Definition: minwinbase.h:81
char * appid
Definition: mkisofs.c:161
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define CREATE_ALWAYS
Definition: disk.h:72
#define CREATE_NEW
Definition: disk.h:69
static PVOID ptr
Definition: dispmode.c:27
static IPrintDialogCallback callback
Definition: printdlg.c:326
const IID IID_IObjectWithSite
static const WCHAR pathW[]
Definition: path.c:2368
static IActiveScriptSite * site
Definition: script.c:149
static const struct access_res create[16]
Definition: package.c:7505
static WCHAR valueW[]
Definition: reg.c:1394
static char * dest
Definition: rtl.c:149
INTERNETFEATURELIST feature
Definition: misc.c:1719
#define argv
Definition: mplay32.c:18
platform
Definition: msipriv.h:364
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:238
#define VER_PLATFORM_WIN32_WINDOWS
Definition: rtltypes.h:237
#define VER_PLATFORM_WIN32s
Definition: rtltypes.h:236
HANDLE hThread
Definition: wizard.c:28
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define KEY_WRITE
Definition: nt_native.h:1034
#define GENERIC_WRITE
Definition: nt_native.h:90
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define KEY_SET_VALUE
Definition: nt_native.h:1020
#define STGM_CREATE
Definition: objbase.h:945
#define STGM_SHARE_DENY_NONE
Definition: objbase.h:939
#define STGM_CONVERT
Definition: objbase.h:946
#define STGM_READWRITE
Definition: objbase.h:938
#define STGM_TRANSACTED
Definition: objbase.h:934
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:942
#define STGM_FAILIFTHERE
Definition: objbase.h:947
#define STGM_DELETEONRELEASE
Definition: objbase.h:944
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:941
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
@ COINIT_DISABLE_OLE1DDE
Definition: objbase.h:281
#define STGM_WRITE
Definition: objbase.h:937
#define STGM_READ
Definition: objbase.h:936
#define STGM_SHARE_DENY_READ
Definition: objbase.h:940
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define OS_WIN2000TERMINAL
Definition: shlwapi.h:238
#define OS_WIN98_GOLD
Definition: shlwapi.h:232
#define OS_APPLIANCE
Definition: shlwapi.h:262
#define OS_WIN95ORGREATER
Definition: shlwapi.h:228
#define OS_MEDIACENTER
Definition: shlwapi.h:261
#define OS_WIN95_GOLD
Definition: shlwapi.h:242
#define OS_SMALLBUSINESSSERVER
Definition: shlwapi.h:258
#define OS_WIN98ORGREATER
Definition: shlwapi.h:231
#define OS_NT
Definition: shlwapi.h:227
#define OS_MEORGREATER
Definition: shlwapi.h:243
#define OS_WIN2000ADVSERVER
Definition: shlwapi.h:236
#define OS_XPORGREATER
Definition: shlwapi.h:244
#define OS_WIN2000ORGREATER
Definition: shlwapi.h:233
#define OS_WIN2000PRO
Definition: shlwapi.h:234
#define OS_WIN2000SERVER
Definition: shlwapi.h:235
#define OS_TERMINALSERVER
Definition: shlwapi.h:250
@ CTF_PROCESS_REF
Definition: shlwapi.h:73
@ CTF_INSIST
Definition: shlwapi.h:71
@ CTF_COINIT
Definition: shlwapi.h:75
@ CTF_THREAD_REF
Definition: shlwapi.h:72
#define OS_SERVERADMINUI
Definition: shlwapi.h:260
#define OS_PROFESSIONAL
Definition: shlwapi.h:246
#define OS_WOW6432
Definition: shlwapi.h:256
#define OS_TERMINALCLIENT
Definition: shlwapi.h:240
#define OS_DOMAINMEMBER
Definition: shlwapi.h:254
#define OS_WIN2000DATACENTER
Definition: shlwapi.h:237
#define OS_NT4ORGREATER
Definition: shlwapi.h:229
#define OS_TABLETPC
Definition: shlwapi.h:259
#define OS_ADVSERVER
Definition: shlwapi.h:248
#define OS_EMBEDDED
Definition: shlwapi.h:239
#define OS_SERVER
Definition: shlwapi.h:249
#define OS_TERMINALREMOTEADMIN
Definition: shlwapi.h:241
#define OS_FASTUSERSWITCHING
Definition: shlwapi.h:252
#define OS_PERSONALTERMINALSERVER
Definition: shlwapi.h:251
#define OS_WELCOMELOGONUI
Definition: shlwapi.h:253
#define OS_HOME
Definition: shlwapi.h:245
#define OS_ANYSERVER
Definition: shlwapi.h:255
#define OS_DATACENTER
Definition: shlwapi.h:247
#define OS_WEBSERVER
Definition: shlwapi.h:257
#define memset(x, y, z)
Definition: compat.h:39
int zero
Definition: sehframes.cpp:29
static const char *static const char const char DWORD void DWORD *static const char const char DWORD void DWORD *static const char DWORD DWORD void DWORD * buff_len
Definition: shcore.c:41
static const char *static const char const char DWORD void DWORD *static const char const char DWORD void DWORD *static const char DWORD DWORD void * buff
Definition: shcore.c:41
BSOS_OPTIONS
Definition: shcore.h:25
PROCESS_DPI_AWARENESS
DISPLAY_DEVICE_TYPE
MONITOR_DPI_TYPE
DEVICE_SCALE_FACTOR
Definition: shtypes.idl:194
@ SCALE_100_PERCENT
Definition: shtypes.idl:196
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR * cmdline
Definition: stretchblt.cpp:32
Definition: scsiwmi.h:51
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwMinorVersion
Definition: rtltypes.h:239
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
struct _ULARGE_INTEGER::@4623 u
Definition: http.c:7252
Definition: cookie.c:34
Definition: name.c:39
Definition: main.c:525
struct shstream::@577::@579 file
WCHAR * valuename
Definition: main.c:538
IStream IStream_iface
Definition: main.c:526
HKEY hkey
Definition: main.c:537
HANDLE handle
Definition: main.c:542
BYTE * buffer
Definition: main.c:533
DWORD position
Definition: main.c:535
WCHAR * path
Definition: main.c:544
DWORD mode
Definition: main.c:543
union shstream::@577 u
struct shstream::@577::@578 mem
DWORD length
Definition: main.c:534
LONG refcount
Definition: main.c:527
Definition: parse.h:23
IStream IStream_iface
Definition: request.c:5732
DWORD flags
Definition: main.c:1576
IUnknown * thread_ref
Definition: main.c:1578
LPTHREAD_START_ROUTINE callback
Definition: main.c:1574
LPTHREAD_START_ROUTINE thread_proc
Definition: main.c:1573
IUnknown * process_ref
Definition: main.c:1579
void * data
Definition: main.c:1575
HANDLE hEvent
Definition: main.c:1577
LONG * refcount
Definition: main.c:1416
IUnknown IUnknown_iface
Definition: main.c:1415
#define max(a, b)
Definition: svc.c:63
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t UINT32
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2513 u
Definition: pdh_main.c:96
OSVERSIONINFO osvi
Definition: ver.c:28
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
int retval
Definition: wcstombs.cpp:91
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FILE_CURRENT
Definition: winbase.h:116
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:529
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DPI_AWARENESS
Definition: windef.h:80
#define WINAPI
Definition: msvc.h:6
#define OS_WIN2000ORGREATER_ALT
Definition: shlwapi.h:1128
#define OS_WIN32SORGREATER
Definition: shlwapi.h:1124
#define STG_E_INVALIDPOINTER
Definition: winerror.h:3666
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOINTERFACE
Definition: winerror.h:3479
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228
#define STG_E_ACCESSDENIED
Definition: winerror.h:3663
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:3675
#define ERROR_KEY_HAS_CHILDREN
Definition: winerror.h:923
#define E_POINTER
Definition: winerror.h:3480
#define STG_E_INVALIDFUNCTION
Definition: winerror.h:3659
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:3665
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define VER_NT_WORKSTATION
struct _OSVERSIONINFOA OSVERSIONINFOA
unsigned char BYTE
Definition: xxhash.c:193