ReactOS 0.4.17-dev-343-gb35a9be
main.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "initguid.h"
#include "ocidl.h"
#include "featurestagingapi.h"
#include "shellscalingapi.h"
#include "shcore.h"
#include "shlwapi.h"
#include "wine/debug.h"
Include dependency graph for main.c:

Go to the source code of this file.

Classes

struct  shstream
 
struct  threadref
 
struct  thread_data
 

Macros

#define COBJMACROS
 
#define WINSHLWAPI
 
#define ISOS_RETURN(x)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shcore)
 
BOOL WINAPI DllMain (HINSTANCE instance, DWORD reason, void *reserved)
 
HRESULT WINAPI GetProcessDpiAwareness (HANDLE process, PROCESS_DPI_AWARENESS *value)
 
HRESULT WINAPI SetProcessDpiAwareness (PROCESS_DPI_AWARENESS value)
 
HRESULT WINAPI GetDpiForMonitor (HMONITOR monitor, MONITOR_DPI_TYPE type, UINT *x, UINT *y)
 
HRESULT WINAPI GetScaleFactorForMonitor (HMONITOR monitor, DEVICE_SCALE_FACTOR *scale)
 
DEVICE_SCALE_FACTOR WINAPI GetScaleFactorForDevice (DISPLAY_DEVICE_TYPE device_type)
 
HRESULT WINAPI _IStream_Read (IStream *stream, void *dest, ULONG size)
 
HRESULT WINAPI IStream_Reset (IStream *stream)
 
HRESULT WINAPI IStream_Size (IStream *stream, ULARGE_INTEGER *size)
 
HRESULT WINAPI _IStream_Write (IStream *stream, const void *src, ULONG size)
 
void WINAPI IUnknown_AtomicRelease (IUnknown **obj)
 
HRESULT WINAPI IUnknown_GetSite (IUnknown *unk, REFIID iid, void **site)
 
HRESULT WINAPI IUnknown_QueryService (IUnknown *obj, REFGUID sid, REFIID iid, void **out)
 
void WINAPI IUnknown_Set (IUnknown **dest, IUnknown *src)
 
HRESULT WINAPI IUnknown_SetSite (IUnknown *obj, IUnknown *site)
 
HRESULT WINAPI SetCurrentProcessExplicitAppUserModelID (const WCHAR *appid)
 
HRESULT WINAPI GetCurrentProcessExplicitAppUserModelID (const WCHAR **appid)
 
WCHAR **WINAPI CommandLineToArgvW (const WCHAR *cmdline, int *numargs)
 
static struct shstreamimpl_from_IStream (IStream *iface)
 
static HRESULT WINAPI shstream_QueryInterface (IStream *iface, REFIID riid, void **out)
 
static ULONG WINAPI shstream_AddRef (IStream *iface)
 
static ULONG WINAPI memstream_Release (IStream *iface)
 
static HRESULT WINAPI memstream_Read (IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
 
static HRESULT WINAPI memstream_Write (IStream *iface, const void *buff, ULONG buff_size, ULONG *written)
 
static HRESULT WINAPI memstream_Seek (IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *new_pos)
 
static HRESULT WINAPI memstream_SetSize (IStream *iface, ULARGE_INTEGER new_size)
 
static HRESULT WINAPI shstream_CopyTo (IStream *iface, IStream *dest, ULARGE_INTEGER size, ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
 
static HRESULT WINAPI shstream_Commit (IStream *iface, DWORD flags)
 
static HRESULT WINAPI shstream_Revert (IStream *iface)
 
static HRESULT WINAPI shstream_LockRegion (IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER size, DWORD lock_type)
 
static HRESULT WINAPI shstream_UnlockRegion (IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER size, DWORD lock_type)
 
static HRESULT WINAPI memstream_Stat (IStream *iface, STATSTG *statstg, DWORD flags)
 
static HRESULT WINAPI shstream_Clone (IStream *iface, IStream **dest)
 
static struct shstreamshstream_create (const IStreamVtbl *vtbl, const BYTE *data, UINT data_len)
 
IStream *WINAPI SHCreateMemStream (const BYTE *data, UINT data_len)
 
static ULONG WINAPI filestream_Release (IStream *iface)
 
static HRESULT WINAPI filestream_Read (IStream *iface, void *buff, ULONG size, ULONG *read_len)
 
static HRESULT WINAPI filestream_Write (IStream *iface, const void *buff, ULONG size, ULONG *written)
 
static HRESULT WINAPI filestream_Seek (IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *new_pos)
 
static HRESULT WINAPI filestream_SetSize (IStream *iface, ULARGE_INTEGER size)
 
static HRESULT WINAPI filestream_CopyTo (IStream *iface, IStream *dest, ULARGE_INTEGER size, ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
 
static HRESULT WINAPI filestream_Commit (IStream *iface, DWORD flags)
 
static HRESULT WINAPI filestream_Stat (IStream *iface, STATSTG *statstg, DWORD flags)
 
HRESULT WINAPI SHCreateStreamOnFileEx (const WCHAR *path, DWORD mode, DWORD attributes, BOOL create, IStream *template, IStream **ret)
 
HRESULT WINAPI SHCreateStreamOnFileW (const WCHAR *path, DWORD mode, IStream **stream)
 
HRESULT WINAPI SHCreateStreamOnFileA (const char *path, DWORD mode, IStream **stream)
 
static ULONG WINAPI regstream_Release (IStream *iface)
 
IStream *WINAPI SHOpenRegStream2W (HKEY hKey, const WCHAR *subkey, const WCHAR *value, DWORD mode)
 
IStream *WINAPI SHOpenRegStream2A (HKEY hKey, const char *subkey, const char *value, DWORD mode)
 
IStream *WINAPI SHOpenRegStreamA (HKEY hkey, const char *subkey, const char *value, DWORD mode)
 
static ULONG WINAPI dummystream_AddRef (IStream *iface)
 
static ULONG WINAPI dummystream_Release (IStream *iface)
 
static HRESULT WINAPI dummystream_Read (IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
 
IStream *WINAPI SHOpenRegStreamW (HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD mode)
 
static struct threadrefthreadref_impl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI threadref_QueryInterface (IUnknown *iface, REFIID riid, void **out)
 
static ULONG WINAPI threadref_AddRef (IUnknown *iface)
 
static ULONG WINAPI threadref_Release (IUnknown *iface)
 
HRESULT WINAPI SHCreateThreadRef (LONG *refcount, IUnknown **out)
 
HRESULT WINAPI SHGetThreadRef (IUnknown **out)
 
HRESULT WINAPI SHSetThreadRef (IUnknown *obj)
 
HRESULT WINAPI SHReleaseThreadRef (void)
 
HRESULT WINAPI GetProcessReference (IUnknown **obj)
 
void WINAPI SetProcessReference (IUnknown *obj)
 
static DWORD WINAPI shcore_thread_wrapper (void *data)
 
BOOL WINAPI SHCreateThread (LPTHREAD_START_ROUTINE thread_proc, void *data, DWORD flags, LPTHREAD_START_ROUTINE callback)
 
HRESULT WINAPI SHStrDupW (const WCHAR *src, WCHAR **dest)
 
HRESULT WINAPI SHStrDupA (const char *src, WCHAR **dest)
 
DWORD WINAPI SHAnsiToAnsi (const char *src, char *dest, int dest_len)
 
DWORD WINAPI SHUnicodeToAnsi (const WCHAR *src, char *dest, int dest_len)
 
DWORD WINAPI SHUnicodeToUnicode (const WCHAR *src, WCHAR *dest, int dest_len)
 
DWORD WINAPI SHAnsiToUnicode (const char *src, WCHAR *dest, int dest_len)
 
HKEY WINAPI SHRegDuplicateHKey (HKEY hKey)
 
DWORD WINAPI SHDeleteEmptyKeyW (HKEY hkey, const WCHAR *subkey)
 
DWORD WINAPI SHDeleteEmptyKeyA (HKEY hkey, const char *subkey)
 
DWORD WINAPI SHDeleteKeyW (HKEY hkey, const WCHAR *subkey)
 
DWORD WINAPI SHDeleteKeyA (HKEY hkey, const char *subkey)
 
DWORD WINAPI SHDeleteValueW (HKEY hkey, const WCHAR *subkey, const WCHAR *value)
 
DWORD WINAPI SHDeleteValueA (HKEY hkey, const char *subkey, const char *value)
 
DWORD WINAPI SHCopyKeyA (HKEY hkey_src, const char *subkey, HKEY hkey_dst, DWORD reserved)
 
DWORD WINAPI SHCopyKeyW (HKEY hkey_src, const WCHAR *subkey, HKEY hkey_dst, DWORD reserved)
 
LONG WINAPI SHEnumKeyExA (HKEY hkey, DWORD index, char *subkey, DWORD *length)
 
LONG WINAPI SHEnumKeyExW (HKEY hkey, DWORD index, WCHAR *subkey, DWORD *length)
 
LONG WINAPI SHEnumValueA (HKEY hkey, DWORD index, char *value, DWORD *length, DWORD *type, void *data, DWORD *data_len)
 
LONG WINAPI SHEnumValueW (HKEY hkey, DWORD index, WCHAR *value, DWORD *length, DWORD *type, void *data, DWORD *data_len)
 
DWORD WINAPI SHQueryValueExW (HKEY hkey, const WCHAR *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
 
DWORD WINAPI SHQueryValueExA (HKEY hkey, const char *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
 
DWORD WINAPI SHGetValueA (HKEY hkey, const char *subkey, const char *value, DWORD *type, void *data, DWORD *data_len)
 
DWORD WINAPI SHGetValueW (HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len)
 
int WINAPI SHRegGetIntW (HKEY hkey, const WCHAR *value, int default_value)
 
DWORD WINAPI SHRegGetPathA (HKEY hkey, const char *subkey, const char *value, char *path, DWORD flags)
 
DWORD WINAPI SHRegGetPathW (HKEY hkey, const WCHAR *subkey, const WCHAR *value, WCHAR *path, DWORD flags)
 
DWORD WINAPI SHSetValueW (HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD type, const void *data, DWORD data_len)
 
DWORD WINAPI SHSetValueA (HKEY hkey, const char *subkey, const char *value, DWORD type, const void *data, DWORD data_len)
 
DWORD WINAPI SHRegSetPathA (HKEY hkey, const char *subkey, const char *value, const char *path, DWORD flags)
 
DWORD WINAPI SHRegSetPathW (HKEY hkey, const WCHAR *subkey, const WCHAR *value, const WCHAR *path, DWORD flags)
 
LONG WINAPI SHQueryInfoKeyA (HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max)
 
LONG WINAPI SHQueryInfoKeyW (HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max)
 
BOOL WINAPI IsOS (DWORD feature)
 
void WINAPI SubscribeFeatureStateChangeNotification (FEATURE_STATE_CHANGE_SUBSCRIPTION *subscription, FEATURE_STATE_CHANGE_CALLBACK *callback, void *context)
 
FEATURE_ENABLED_STATE WINAPI GetFeatureEnabledState (UINT32 feature, FEATURE_CHANGE_TIME change_time)
 
HRESULT WINAPI RegisterScaleChangeEvent (HANDLE handle, DWORD_PTR *cookie)
 
HRESULT WINAPI RegisterScaleChangeNotifications (DISPLAY_DEVICE_TYPE display_device, HWND hwnd, UINT msg, DWORD *cookie)
 
HRESULT WINAPI CreateRandomAccessStreamOverStream (IStream *stream, BSOS_OPTIONS options, REFIID riid, void **ppv)
 

Variables

static DWORD shcore_tls
 
static IUnknownprocess_ref
 
static const IStreamVtbl memstreamvtbl
 
static const IStreamVtbl filestreamvtbl
 
static const IStreamVtbl regstreamvtbl
 
static const IStreamVtbl dummystreamvtbl
 
static struct shstream dummyregstream = { { &dummystreamvtbl } }
 
static const IUnknownVtbl threadrefvtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file main.c.

◆ ISOS_RETURN

#define ISOS_RETURN (   x)
Value:
TRACE("(%#lx) ret %d\n",feature,(x)); \
return (x)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
INTERNETFEATURELIST feature
Definition: misc.c:1719
#define TRACE(s)
Definition: solgame.cpp:4

◆ WINSHLWAPI

#define WINSHLWAPI

Definition at line 33 of file main.c.

Function Documentation

◆ _IStream_Read()

HRESULT WINAPI _IStream_Read ( IStream stream,
void dest,
ULONG  size 
)

Definition at line 98 of file main.c.

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}
#define read
Definition: acwin.h:97
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
GLsizeiptr size
Definition: glext.h:5919
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static char * dest
Definition: rtl.c:149
Definition: parse.h:23
uint32_t ULONG
Definition: typedefs.h:59

◆ _IStream_Write()

HRESULT WINAPI _IStream_Write ( IStream stream,
const void src,
ULONG  size 
)

Definition at line 136 of file main.c.

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}
GLenum src
Definition: glext.h:6340

◆ CommandLineToArgvW()

WCHAR **WINAPI CommandLineToArgvW ( const WCHAR cmdline,
int numargs 
)

Definition at line 294 of file main.c.

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}
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
MonoAssembly int argc
Definition: metahost.c:107
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039
GLenum GLsizei len
Definition: glext.h:6722
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define d
Definition: ke_i.h:81
#define LMEM_FIXED
Definition: minwinbase.h:81
#define argv
Definition: mplay32.c:18
short WCHAR
Definition: pedump.c:58
TCHAR * cmdline
Definition: stretchblt.cpp:32

Referenced by _tmain(), CmdDebugService(), command_line_to_args(), DisplayApplet(), DoEntry(), get_utf8_args(), main(), ParseCmdAndExecute(), CCleanMgrModule::ParseCommandLine(), PrintUIEntryW(), ProcessCmdLine(), ProcessCommandLine(), test_commandline2argv(), test_one_cmdline(), and wWinMain().

◆ CreateRandomAccessStreamOverStream()

HRESULT WINAPI CreateRandomAccessStreamOverStream ( IStream stream,
BSOS_OPTIONS  options,
REFIID  riid,
void **  ppv 
)

Definition at line 2593 of file main.c.

2594{
2595 FIXME("(%p, %d, %s, %p) stub\n", stream, options, debugstr_guid(riid), ppv);
2596 return E_NOTIMPL;
2597}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  instance,
DWORD  reason,
void reserved 
)

Definition at line 43 of file main.c.

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}
#define TRUE
Definition: types.h:120
static HINSTANCE instance
Definition: main.c:40
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
DWORD WINAPI DECLSPEC_HOTPATCH TlsAlloc(void)
Definition: thread.c:657
static DWORD shcore_tls
Definition: main.c:40
r reserved
Definition: btrfs.c:3006
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:529

◆ dummystream_AddRef()

static ULONG WINAPI dummystream_AddRef ( IStream iface)
static

Definition at line 1361 of file main.c.

1362{
1363 TRACE("()\n");
1364 return 2;
1365}

◆ dummystream_Read()

static HRESULT WINAPI dummystream_Read ( IStream iface,
void buff,
ULONG  buff_size,
ULONG read_len 
)
static

Definition at line 1373 of file main.c.

1374{
1375 if (read_len)
1376 *read_len = 0;
1377
1378 return E_NOTIMPL;
1379}

◆ dummystream_Release()

static ULONG WINAPI dummystream_Release ( IStream iface)
static

Definition at line 1367 of file main.c.

1368{
1369 TRACE("()\n");
1370 return 1;
1371}

◆ filestream_Commit()

static HRESULT WINAPI filestream_Commit ( IStream iface,
DWORD  flags 
)
static

Definition at line 1033 of file main.c.

1034{
1035 TRACE("%p, %#lx.\n", iface, flags);
1036
1037 return S_OK;
1038}
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:52

◆ filestream_CopyTo()

static HRESULT WINAPI filestream_CopyTo ( IStream iface,
IStream dest,
ULARGE_INTEGER  size,
ULARGE_INTEGER read_len,
ULARGE_INTEGER written 
)
static

Definition at line 990 of file main.c.

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}
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
static struct shstream * impl_from_IStream(IStream *iface)
Definition: main.c:549
GLint left
Definition: glext.h:7726
#define FAILED(hr)
Definition: intsafe.h:51
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
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
Definition: main.c:525

◆ filestream_Read()

static HRESULT WINAPI filestream_Read ( IStream iface,
void buff,
ULONG  size,
ULONG read_len 
)
static

Definition at line 900 of file main.c.

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}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define S_FALSE
Definition: winerror.h:3451

◆ filestream_Release()

static ULONG WINAPI filestream_Release ( IStream iface)
static

Definition at line 883 of file main.c.

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}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
#define CloseHandle
Definition: compat.h:739
LONG refcount
Definition: main.c:527

◆ filestream_Seek()

static HRESULT WINAPI filestream_Seek ( IStream iface,
LARGE_INTEGER  move,
DWORD  origin,
ULARGE_INTEGER new_pos 
)
static

Definition at line 944 of file main.c.

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}
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
#define SetFilePointer
Definition: compat.h:743
voidpf uLong int origin
Definition: ioapi.h:144
struct _ULARGE_INTEGER::@4623 u
DWORD position
Definition: main.c:535
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2513 u
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210

◆ filestream_SetSize()

static HRESULT WINAPI filestream_SetSize ( IStream iface,
ULARGE_INTEGER  size 
)
static

Definition at line 964 of file main.c.

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}
#define FILE_BEGIN
Definition: compat.h:761
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
#define STGM_READ
Definition: objbase.h:936
#define FILE_CURRENT
Definition: winbase.h:116

◆ filestream_Stat()

static HRESULT WINAPI filestream_Stat ( IStream iface,
STATSTG *  statstg,
DWORD  flags 
)
static

Definition at line 1040 of file main.c.

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}
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:442
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memset(x, y, z)
Definition: compat.h:39
#define STG_E_INVALIDPOINTER
Definition: winerror.h:3666

◆ filestream_Write()

static HRESULT WINAPI filestream_Write ( IStream iface,
const void buff,
ULONG  size,
ULONG written 
)
static

Definition at line 919 of file main.c.

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}
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
#define STGM_READWRITE
Definition: objbase.h:938
#define STGM_WRITE
Definition: objbase.h:937
#define STG_E_ACCESSDENIED
Definition: winerror.h:3663

◆ GetCurrentProcessExplicitAppUserModelID()

HRESULT WINAPI GetCurrentProcessExplicitAppUserModelID ( const WCHAR **  appid)

Definition at line 260 of file main.c.

261{
262 FIXME("%p: stub\n", appid);
263 *appid = NULL;
264 return E_NOTIMPL;
265}
char * appid
Definition: mkisofs.c:161

◆ GetDpiForMonitor()

HRESULT WINAPI GetDpiForMonitor ( HMONITOR  monitor,
MONITOR_DPI_TYPE  type,
UINT x,
UINT y 
)

Definition at line 76 of file main.c.

77{
78 if (GetDpiForMonitorInternal( monitor, type, x, y )) return S_OK;
80}
BOOL WINAPI GetDpiForMonitorInternal(_In_ HMONITOR monitor, _In_ UINT type, _Out_ UINT *x, _Out_ UINT *y)
Definition: dpi.c:113
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ GetFeatureEnabledState()

FEATURE_ENABLED_STATE WINAPI GetFeatureEnabledState ( UINT32  feature,
FEATURE_CHANGE_TIME  change_time 
)

Definition at line 2563 of file main.c.

2564{
2565 FIXME("(%u, %u) stub\n", feature, change_time);
2567}
@ FEATURE_ENABLED_STATE_DEFAULT

◆ GetProcessDpiAwareness()

HRESULT WINAPI GetProcessDpiAwareness ( HANDLE  process,
PROCESS_DPI_AWARENESS value 
)

Definition at line 64 of file main.c.

65{
68}
BOOL WINAPI GetProcessDpiAwarenessInternal(_In_ HANDLE process, _Out_ DPI_AWARENESS *awareness)
Definition: dpi.c:88
Definition: pdh_main.c:96
DPI_AWARENESS
Definition: windef.h:80

◆ GetProcessReference()

HRESULT WINAPI GetProcessReference ( IUnknown **  obj)

Definition at line 1546 of file main.c.

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}
static IUnknown * process_ref
Definition: main.c:41

Referenced by init(), and SHCreateThread().

◆ GetScaleFactorForDevice()

DEVICE_SCALE_FACTOR WINAPI GetScaleFactorForDevice ( DISPLAY_DEVICE_TYPE  device_type)

Definition at line 91 of file main.c.

92{
93 FIXME("%d\n", device_type);
94
95 return SCALE_100_PERCENT;
96}
device_type
@ SCALE_100_PERCENT
Definition: shtypes.idl:196

◆ GetScaleFactorForMonitor()

HRESULT WINAPI GetScaleFactorForMonitor ( HMONITOR  monitor,
DEVICE_SCALE_FACTOR scale 
)

Definition at line 83 of file main.c.

84{
85 FIXME("(%p %p): stub\n", monitor, scale);
86
88 return S_OK;
89}
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032

◆ impl_from_IStream()

◆ IsOS()

BOOL WINAPI IsOS ( DWORD  feature)

Definition at line 2392 of file main.c.

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}
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
BOOL WINAPI GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation)
Definition: version.c:69
BOOL is_wow64
Definition: main.c:38
DWORD WINAPI SHQueryValueExW(HKEY hkey, const WCHAR *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
Definition: main.c:2101
#define ISOS_RETURN(x)
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
FxAutoRegKey hKey
platform
Definition: msipriv.h:364
#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
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#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
#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
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwMinorVersion
Definition: rtltypes.h:239
OSVERSIONINFO osvi
Definition: ver.c:28
#define OS_WIN2000ORGREATER_ALT
Definition: shlwapi.h:1128
#define OS_WIN32SORGREATER
Definition: shlwapi.h:1124
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define VER_NT_WORKSTATION
struct _OSVERSIONINFOA OSVERSIONINFOA

Referenced by CDefView::GetDefaultViewMode(), CShellDispatch::GetSetting(), CShellDispatch::GetSystemInformation(), InitializeServerAdminUI(), IsSystem64Bit(), and CControlPanelFolder::MessageSFVCB().

◆ IStream_Reset()

HRESULT WINAPI IStream_Reset ( IStream stream)

Definition at line 111 of file main.c.

112{
113 static const LARGE_INTEGER zero;
114
115 TRACE("(%p)\n", stream);
116
117 return IStream_Seek(stream, zero, 0, NULL);
118}
int zero
Definition: sehframes.cpp:29

Referenced by Open().

◆ IStream_Size()

HRESULT WINAPI IStream_Size ( IStream stream,
ULARGE_INTEGER size 
)

Definition at line 120 of file main.c.

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}

Referenced by CDesktopUpgradePropertyBag::_GetOldDesktopViewStream(), CRegPropertyBag::_GetStreamSize(), CDesktopUpgradePropertyBag::_NewStreamFromOld(), and init().

◆ IUnknown_AtomicRelease()

void WINAPI IUnknown_AtomicRelease ( IUnknown **  obj)

Definition at line 150 of file main.c.

151{
152 TRACE("(%p)\n", obj);
153
154 if (!obj || !*obj)
155 return;
156
157 IUnknown_Release(*obj);
158 *obj = NULL;
159}

Referenced by IUnknown_Set().

◆ IUnknown_GetSite()

HRESULT WINAPI IUnknown_GetSite ( IUnknown unk,
REFIID  iid,
void **  site 
)

Definition at line 161 of file main.c.

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}
#define E_INVALIDARG
Definition: ddrawi.h:101
const IID IID_IObjectWithSite
static IActiveScriptSite * site
Definition: script.c:149

Referenced by CMenuDeskBar::_IsSubMenuParent(), CShellMenuCallback::OnInitMenu(), and CMenuFocusManager::UpdateFocus().

◆ IUnknown_QueryService()

HRESULT WINAPI IUnknown_QueryService ( IUnknown obj,
REFGUID  sid,
REFIID  iid,
void **  out 
)

Definition at line 181 of file main.c.

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}
FT_UInt sid
Definition: cffcmap.c:138
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by CDefViewBckgrndMenu::_bIsDesktopBrowserMenu(), CExplorerBand::_CreateTreeView(), CExplorerBand::_DestroyTreeView(), CDefView::_MergeToolbar(), CMenuDeskBar::_OnActivate(), CDefaultContextMenu::BrowserFlagsFromVerb(), CDefaultContextMenu::DoCopyOrCut(), CDefaultContextMenu::DoCreateNewFolder(), CDefaultContextMenu::DoRename(), CFSDropTarget::Drop(), CMenuDeskBar::Exec(), CAddressEditBox::Execute(), CBandProxy::FindBrowserWindow(), CAddressEditBox::GetAbsolutePidl(), CShellBrowser::GetMenuBand(), CSearchBar::GetSearchResultsFolder(), CRegTreeOptions::GetSetState(), CFolderOptions::HandleDefFolderSettings(), CAddressEditBox::Init(), CDefViewBckgrndMenu::InvokeCommand(), CNetConUiObject::InvokeCommand(), CAddressBand::IsGoButtonVisible(), CMenuFocusManager::IsTrackedWindowOrParent(), IUnknown_QueryServiceForWebBrowserApp(), IUnknown_QueryServicePropertyBag(), CFindFolder::MessageSFVCB(), CSearchBar::OnInitDialog(), CInternetToolbar::OnMenuDropDown(), CSearchBar::OnSearchButtonClicked(), CInternetToolbar::OnTravelBack(), CInternetToolbar::OnTravelForward(), CAddressEditBox::ParseNow(), CMenuDeskBar::Popup(), QueryActiveShellView(), CInternetToolbar::QueryService(), CDefView::QueryService(), CMenuDeskBar::QueryService(), CMenuSite::QueryService(), CDefaultContextMenu::QueryService(), CNewMenu::SelectNewItem(), CAddressEditBox::SetOwner(), CInternetToolbar::SetSite(), CMenuBand::SetSite(), CMenuDeskBar::SetSite(), SHShouldShowWizards(), CDefaultContextMenu::TryToBrowse(), and CMenuBand::UIActivateIO().

◆ IUnknown_Set()

void WINAPI IUnknown_Set ( IUnknown **  dest,
IUnknown src 
)

Definition at line 209 of file main.c.

210{
211 TRACE("(%p, %p)\n", dest, src);
212
214
215 if (src)
216 {
217 IUnknown_AddRef(src);
218 *dest = src;
219 }
220}
void WINAPI IUnknown_AtomicRelease(IUnknown **obj)
Definition: main.c:150

Referenced by Free(), and CFindFolderContextMenu::SetSite().

◆ IUnknown_SetSite()

HRESULT WINAPI IUnknown_SetSite ( IUnknown obj,
IUnknown site 
)

Definition at line 222 of file main.c.

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}

Referenced by CMenuBand::_OnPopupSubMenu(), CMenuSite::AddBand(), CShellBrowser::BrowseToPath(), CreateStartMenu(), DCMA_DestroyEntry(), DCMA_InsertMenuItems(), CShellBrowser::DoFolderOptions(), CDefView::drag_notify_subitem(), CDefView::FillFileMenu(), CShellBrowser::GetBaseBar(), CDefView::GetItemObject(), CShellBrowser::Initialize(), CDockSite::Initialize(), CDefView::InvokeContextMenuCommand(), CDefaultContextMenu::LoadDynamicContextMenuHandler(), CDefView::OnDestroy(), CMenuBand::SetClient(), CMenuSite::SetDeskBarSite(), CFindFolderContextMenu::SetSite(), CDefViewBckgrndMenu::SetSite(), SHInvokeCommandOnContextMenuInternal(), SHInvokeCommandsOnContextMenu(), CDefaultContextMenu::~CDefaultContextMenu(), and MenuCleanup::~MenuCleanup().

◆ memstream_Read()

static HRESULT WINAPI memstream_Read ( IStream iface,
void buff,
ULONG  buff_size,
ULONG read_len 
)
static

Definition at line 600 of file main.c.

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}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define memmove(s1, s2, n)
Definition: mkisofs.h:881

◆ memstream_Release()

static ULONG WINAPI memstream_Release ( IStream iface)
static

Definition at line 584 of file main.c.

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}

◆ memstream_Seek()

static HRESULT WINAPI memstream_Seek ( IStream iface,
LARGE_INTEGER  move,
DWORD  origin,
ULARGE_INTEGER new_pos 
)
static

Definition at line 655 of file main.c.

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}
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:3675
#define STG_E_INVALIDFUNCTION
Definition: winerror.h:3659

◆ memstream_SetSize()

static HRESULT WINAPI memstream_SetSize ( IStream iface,
ULARGE_INTEGER  new_size 
)
static

Definition at line 682 of file main.c.

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}
_ACRTIMP void *__cdecl _recalloc(void *, size_t, size_t) __WINE_ALLOC_SIZE(2
size_t const new_size
Definition: expand.cpp:66
GLuint buffer
Definition: glext.h:5915
#define STG_E_INSUFFICIENTMEMORY
Definition: winerror.h:3665
unsigned char BYTE
Definition: xxhash.c:193

◆ memstream_Stat()

static HRESULT WINAPI memstream_Stat ( IStream iface,
STATSTG *  statstg,
DWORD  flags 
)
static

Definition at line 790 of file main.c.

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}

◆ memstream_Write()

static HRESULT WINAPI memstream_Write ( IStream iface,
const void buff,
ULONG  buff_size,
ULONG written 
)
static

Definition at line 627 of file main.c.

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}
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

◆ RegisterScaleChangeEvent()

HRESULT WINAPI RegisterScaleChangeEvent ( HANDLE  handle,
DWORD_PTR cookie 
)

Definition at line 2572 of file main.c.

2573{
2574 FIXME("(%p, %p) stub\n", handle, cookie);
2575 return E_NOTIMPL;
2576}
Definition: cookie.c:34

◆ RegisterScaleChangeNotifications()

HRESULT WINAPI RegisterScaleChangeNotifications ( DISPLAY_DEVICE_TYPE  display_device,
HWND  hwnd,
UINT  msg,
DWORD cookie 
)

Definition at line 2581 of file main.c.

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}
#define msg(x)
Definition: auth_time.c:54
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ regstream_Release()

static ULONG WINAPI regstream_Release ( IStream iface)
static

Definition at line 1219 of file main.c.

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}
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 RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define REG_BINARY
Definition: nt_native.h:1499

◆ SetCurrentProcessExplicitAppUserModelID()

HRESULT WINAPI SetCurrentProcessExplicitAppUserModelID ( const WCHAR appid)

Definition at line 254 of file main.c.

255{
256 FIXME("%s: stub\n", debugstr_w(appid));
257 return S_OK;
258}
#define debugstr_w
Definition: kernel32.h:32

◆ SetProcessDpiAwareness()

HRESULT WINAPI SetProcessDpiAwareness ( PROCESS_DPI_AWARENESS  value)

Definition at line 70 of file main.c.

71{
74}
BOOL WINAPI SetProcessDpiAwarenessInternal(_In_ DPI_AWARENESS awareness)
Definition: dpi.c:101

Referenced by set_dpi_aware().

◆ SetProcessReference()

void WINAPI SetProcessReference ( IUnknown obj)

Definition at line 1564 of file main.c.

1565{
1566 TRACE("(%p)\n", obj);
1567
1568 process_ref = obj;
1569}

Referenced by init().

◆ SHAnsiToAnsi()

DWORD WINAPI SHAnsiToAnsi ( const char src,
char dest,
int  dest_len 
)

Definition at line 1738 of file main.c.

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}
#define lstrcpynA
Definition: compat.h:751
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
return ret
Definition: mutex.c:146
#define debugstr_a
Definition: kernel32.h:31

Referenced by init().

◆ SHAnsiToUnicode()

DWORD WINAPI SHAnsiToUnicode ( const char src,
WCHAR dest,
int  dest_len 
)

◆ SHCopyKeyA()

DWORD WINAPI SHCopyKeyA ( HKEY  hkey_src,
const char subkey,
HKEY  hkey_dst,
DWORD  reserved 
)

Definition at line 1950 of file main.c.

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}
HRESULT WINAPI SHStrDupA(const char *src, WCHAR **dest)
Definition: main.c:1716
DWORD WINAPI SHCopyKeyW(HKEY hkey_src, const WCHAR *subkey, HKEY hkey_dst, DWORD reserved)
Definition: main.c:1968

Referenced by init().

◆ SHCopyKeyW()

DWORD WINAPI SHCopyKeyW ( HKEY  hkey_src,
const WCHAR subkey,
HKEY  hkey_dst,
DWORD  reserved 
)

Definition at line 1968 of file main.c.

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}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define malloc
Definition: debug_ros.c:4
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 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 RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
DWORD WINAPI SHSetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD type, const void *data, DWORD data_len)
Definition: main.c:2292
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
static PVOID ptr
Definition: dispmode.c:27
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
Definition: name.c:39
#define max(a, b)
Definition: svc.c:63

Referenced by COpenWithList::SetDefaultHandler(), SHCopyKeyA(), and SHCopyKeyW().

◆ shcore_thread_wrapper()

static DWORD WINAPI shcore_thread_wrapper ( void data)
static

Definition at line 1582 of file main.c.

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}
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
@ COINIT_DISABLE_OLE1DDE
Definition: objbase.h:281
@ CTF_COINIT
Definition: shlwapi.h:75
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
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
int retval
Definition: wcstombs.cpp:91

Referenced by SHCreateThread().

◆ SHCreateMemStream()

◆ SHCreateStreamOnFileA()

HRESULT WINAPI SHCreateStreamOnFileA ( const char path,
DWORD  mode,
IStream **  stream 
)

Definition at line 1196 of file main.c.

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}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI SHCreateStreamOnFileW(const WCHAR *path, DWORD mode, IStream **stream)
Definition: main.c:1180
GLenum mode
Definition: glext.h:6217
static const WCHAR pathW[]
Definition: path.c:2368
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228

Referenced by init(), and test_SHCreateStreamOnFileA().

◆ SHCreateStreamOnFileEx()

HRESULT WINAPI SHCreateStreamOnFileEx ( const WCHAR path,
DWORD  mode,
DWORD  attributes,
BOOL  create,
IStream template,
IStream **  ret 
)

Definition at line 1097 of file main.c.

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}
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
static const IStreamVtbl filestreamvtbl
Definition: main.c:1076
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define CREATE_ALWAYS
Definition: disk.h:72
#define CREATE_NEW
Definition: disk.h:69
static const struct access_res create[16]
Definition: package.c:7505
_In_ HANDLE hFile
Definition: mswsock.h:90
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
#define STGM_CREATE
Definition: objbase.h:945
#define STGM_SHARE_DENY_NONE
Definition: objbase.h:939
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:942
#define STGM_FAILIFTHERE
Definition: objbase.h:947
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:941
#define STGM_SHARE_DENY_READ
Definition: objbase.h:940
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94

Referenced by DoLoadPicture(), OpenStreamOnFile(), SHCreateStreamOnFileW(), test_SHCreateStreamOnFileEx(), and test_SHCreateStreamOnFileEx_CopyTo().

◆ SHCreateStreamOnFileW()

HRESULT WINAPI SHCreateStreamOnFileW ( const WCHAR path,
DWORD  mode,
IStream **  stream 
)

Definition at line 1180 of file main.c.

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}
HRESULT WINAPI SHCreateStreamOnFileEx(const WCHAR *path, DWORD mode, DWORD attributes, BOOL create, IStream *template, IStream **ret)
Definition: main.c:1097
#define STGM_CONVERT
Definition: objbase.h:946
#define STGM_TRANSACTED
Definition: objbase.h:934
#define STGM_DELETEONRELEASE
Definition: objbase.h:944

Referenced by dump_stream_to_file(), GdipCreateStreamOnFile(), IWICStreamImpl_InitializeFromFilename(), CShellLink::Load(), Open(), CShellLink::Save(), SHCreateStreamOnFileA(), and test_SHCreateStreamOnFileW().

◆ SHCreateThread()

BOOL WINAPI SHCreateThread ( LPTHREAD_START_ROUTINE  thread_proc,
void data,
DWORD  flags,
LPTHREAD_START_ROUTINE  callback 
)

Definition at line 1628 of file main.c.

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}
static DWORD WINAPI thread_proc(void *param)
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
HRESULT WINAPI SHGetThreadRef(IUnknown **out)
Definition: main.c:1505
static DWORD WINAPI shcore_thread_wrapper(void *data)
Definition: main.c:1582
HRESULT WINAPI GetProcessReference(IUnknown **obj)
Definition: main.c:1546
#define INFINITE
Definition: serial.h:102
static IPrintDialogCallback callback
Definition: printdlg.c:326
HANDLE hThread
Definition: wizard.c:28
@ CTF_PROCESS_REF
Definition: shlwapi.h:73
@ CTF_INSIST
Definition: shlwapi.h:71
@ CTF_THREAD_REF
Definition: shlwapi.h:72
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

Referenced by CRecyclerDropTarget::_DoDeleteAsync(), DoFormatDriveAsync(), CFSDropTarget::Drop(), EnableCommandIfVerbExists(), CCabFolder::ExtractFilesUI(), FormatDriveDlg(), CTrayWindow::HandleCommand(), CFileDefExt::InitFileAttr(), CFileDefExt::InitMultifilePage(), InstallDlgProc(), ShellPropSheetDialog::ShowAsync(), ShowFolderOptionsDialog(), CFindFolder::StartSearch(), and UIDlgProc().

◆ SHCreateThreadRef()

HRESULT WINAPI SHCreateThreadRef ( LONG refcount,
IUnknown **  out 
)

Definition at line 1478 of file main.c.

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}
static const IUnknownVtbl threadrefvtbl
Definition: main.c:1468
LONG * refcount
Definition: main.c:1416
IUnknown IUnknown_iface
Definition: main.c:1415

Referenced by SHCreateFromDesktop().

◆ SHDeleteEmptyKeyA()

DWORD WINAPI SHDeleteEmptyKeyA ( HKEY  hkey,
const char subkey 
)

Definition at line 1868 of file main.c.

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}
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
DWORD WINAPI SHDeleteEmptyKeyW(HKEY hkey, const WCHAR *subkey)
Definition: main.c:1840

◆ SHDeleteEmptyKeyW()

DWORD WINAPI SHDeleteEmptyKeyW ( HKEY  hkey,
const WCHAR subkey 
)

Definition at line 1840 of file main.c.

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}
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define ERROR_KEY_HAS_CHILDREN
Definition: winerror.h:923

Referenced by SHDeleteEmptyKeyA().

◆ SHDeleteKeyA()

DWORD WINAPI SHDeleteKeyA ( HKEY  hkey,
const char subkey 
)

Definition at line 1896 of file main.c.

1897{
1898 TRACE("(%p, %s)\n", hkey, debugstr_a(subkey));
1899
1900 return RegDeleteTreeA(hkey, subkey);
1901}
LONG WINAPI RegDeleteTreeA(IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL)
Definition: reg.c:1805

Referenced by delete_key(), init(), test_getstring_no_extra(), test_SHCopyKey(), test_SHDeleteKey(), and testRegStore().

◆ SHDeleteKeyW()

DWORD WINAPI SHDeleteKeyW ( HKEY  hkey,
const WCHAR subkey 
)

Definition at line 1886 of file main.c.

1887{
1888 TRACE("(%p, %s)\n", hkey, debugstr_w(subkey));
1889
1890 return RegDeleteTreeW(hkey, subkey);
1891}
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)

Referenced by CMruNode::_DeleteValue(), CleanupRegistry(), DeleteExt(), EditTypeDlg_WriteClass(), HandleMruData(), MRUList_DataList(), MRUList_PidlList(), PNP_DeleteClassKey(), and SHAddToRecentDocs().

◆ SHDeleteValueA()

DWORD WINAPI SHDeleteValueA ( HKEY  hkey,
const char subkey,
const char value 
)

Definition at line 1926 of file main.c.

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}
DWORD WINAPI SHDeleteValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value)
Definition: main.c:1906
static WCHAR valueW[]
Definition: reg.c:1394

Referenced by test_objecttag(), UnregisterExtensionForMIMETypeA(), and UnregisterMIMETypeForExtensionA().

◆ SHDeleteValueW()

DWORD WINAPI SHDeleteValueW ( HKEY  hkey,
const WCHAR subkey,
const WCHAR value 
)

Definition at line 1906 of file main.c.

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}
#define KEY_SET_VALUE
Definition: nt_native.h:1020

Referenced by CMruBase::_DeleteValue(), CMruLongList::_ImportShortList(), MRUList_DataList(), CGlobalFolderSettings::Save(), CRegFolder::SetNameOf(), SHDeleteValueA(), UnregisterExtensionForMIMETypeW(), UnregisterMIMETypeForExtensionW(), and CRegPropertyBag::Write().

◆ SHEnumKeyExA()

LONG WINAPI SHEnumKeyExA ( HKEY  hkey,
DWORD  index,
char subkey,
DWORD length 
)

Definition at line 2059 of file main.c.

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}
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
GLuint index
Definition: glext.h:6031

◆ SHEnumKeyExW()

LONG WINAPI SHEnumKeyExW ( HKEY  hkey,
DWORD  index,
WCHAR subkey,
DWORD length 
)

Definition at line 2069 of file main.c.

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}

◆ SHEnumValueA()

LONG WINAPI SHEnumValueA ( HKEY  hkey,
DWORD  index,
char value,
DWORD length,
DWORD type,
void data,
DWORD data_len 
)

Definition at line 2079 of file main.c.

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}
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

◆ SHEnumValueW()

LONG WINAPI SHEnumValueW ( HKEY  hkey,
DWORD  index,
WCHAR value,
DWORD length,
DWORD type,
void data,
DWORD data_len 
)

Definition at line 2090 of file main.c.

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}

◆ SHGetThreadRef()

HRESULT WINAPI SHGetThreadRef ( IUnknown **  out)

Definition at line 1505 of file main.c.

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}
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1240
#define E_NOINTERFACE
Definition: winerror.h:3479

Referenced by SHCreateThread().

◆ SHGetValueA()

DWORD WINAPI SHGetValueA ( HKEY  hkey,
const char subkey,
const char value,
DWORD type,
void data,
DWORD data_len 
)

Definition at line 2197 of file main.c.

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}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
DWORD WINAPI SHQueryValueExA(HKEY hkey, const char *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
Definition: main.c:2149
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019

Referenced by getregdw(), init(), MIME_GetExtensionA(), PathIsContentTypeA(), SHGetValueGoodBootA(), SHLWAPI_GetMappedFlags(), SHLWAPI_GetRegistryCompatFlags(), SHLWAPI_UseSystemForSystemFolders(), SHRegGetPathA(), and test_SHGetValue().

◆ SHGetValueW()

DWORD WINAPI SHGetValueW ( HKEY  hkey,
const WCHAR subkey,
const WCHAR value,
DWORD type,
void data,
DWORD data_len 
)

Definition at line 2222 of file main.c.

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}

Referenced by _AllocValueString(), CDesktopUpgradePropertyBag::_AlreadyUpgraded(), CBandSiteMenu::_CreateMenuPart(), CViewStatePropertyBag::_GetMRUSize(), CMruShortList::_InitSlots(), CMruLongList::_InitSlots(), CMruBase::_LoadItem(), CMruPidlList::_LoadNodeSlots(), CRegPropertyBag::_ReadBinary(), CRegPropertyBag::_ReadDword(), CDesktopUpgradePropertyBag::_ReadFlags(), CRegPropertyBag::_ReadString(), Candidate_SHGetRestriction(), CTrayWindow::DoExitWindows(), GetAssocClass(), CRegFolder::GetDisplayNameOf(), CMruNode::GetNodeSlot(), GetZipCodePage(), HCR_GetExecuteCommandW(), InitializeServerAdminUI(), TaskbarSettings::Load(), MIME_GetExtensionW(), MRUList_Check(), MRUList_DataList(), MRUList_PidlList_0(), PathIsContentTypeW(), CRegistrySource::QueryValueDword(), CRegistrySource::QueryValueExists(), CRegistrySource::QueryValueString(), CRegPropertyBag::Read(), SHAboutInfoW(), SHCreatePropSheetExtArrayEx(), SHELL32_ReadRegShellState(), SHELL_GetCachedComputerDescription(), SHGetRestriction(), SHGetValueGoodBootW(), SHRegGetPathW(), SIC_GetMetricsValue(), and CDefView::UpdateListColors().

◆ SHOpenRegStream2A()

IStream *WINAPI SHOpenRegStream2A ( HKEY  hKey,
const char subkey,
const char value,
DWORD  mode 
)

Definition at line 1316 of file main.c.

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}
IStream *WINAPI SHOpenRegStream2W(HKEY hKey, const WCHAR *subkey, const WCHAR *value, DWORD mode)
Definition: main.c:1266

◆ SHOpenRegStream2W()

IStream *WINAPI SHOpenRegStream2W ( HKEY  hKey,
const WCHAR subkey,
const WCHAR value,
DWORD  mode 
)

Definition at line 1266 of file main.c.

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}
#define ERROR_SUCCESS
Definition: deptool.c:10
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 RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
HRESULT WINAPI SHStrDupW(const WCHAR *src, WCHAR **dest)
Definition: main.c:1692
static const IStreamVtbl regstreamvtbl
Definition: main.c:1245
#define KEY_WRITE
Definition: nt_native.h:1034
long LONG
Definition: pedump.c:60

Referenced by CDesktopUpgradePropertyBag::_GetOldDesktopViewStream(), CDefView::GetDefaultViewStream(), CInternetToolbar::GetStream(), SHOpenRegStream2A(), and SHOpenRegStreamW().

◆ SHOpenRegStreamA()

IStream *WINAPI SHOpenRegStreamA ( HKEY  hkey,
const char subkey,
const char value,
DWORD  mode 
)

Definition at line 1340 of file main.c.

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}
IStream *WINAPI SHOpenRegStreamW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD mode)
Definition: main.c:1404

◆ SHOpenRegStreamW()

IStream *WINAPI SHOpenRegStreamW ( HKEY  hkey,
const WCHAR subkey,
const WCHAR value,
DWORD  mode 
)

Definition at line 1404 of file main.c.

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}
static struct shstream dummyregstream
Definition: main.c:1399

Referenced by CTrayBandSite::GetDefaultBandsStream(), CTrayBandSite::GetUserBandsStream(), and SHOpenRegStreamA().

◆ SHQueryInfoKeyA()

LONG WINAPI SHQueryInfoKeyA ( HKEY  hkey,
DWORD subkeys,
DWORD subkey_max,
DWORD values,
DWORD value_max 
)

Definition at line 2372 of file main.c.

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}
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
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666

◆ SHQueryInfoKeyW()

LONG WINAPI SHQueryInfoKeyW ( HKEY  hkey,
DWORD subkeys,
DWORD subkey_max,
DWORD values,
DWORD value_max 
)

Definition at line 2382 of file main.c.

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}

◆ SHQueryValueExA()

DWORD WINAPI SHQueryValueExA ( HKEY  hkey,
const char name,
DWORD reserved,
DWORD type,
void buff,
DWORD buff_len 
)

Definition at line 2149 of file main.c.

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}
#define ERROR_MORE_DATA
Definition: dderror.h:13
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
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:372
#define REG_SZ
Definition: layer.c:22
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
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

Referenced by init(), SHADD_get_policy(), SHGetValueA(), SHRegQueryValueExA(), test_SHCopyKey(), and test_SHQueryValueEx().

◆ SHQueryValueExW()

DWORD WINAPI SHQueryValueExW ( HKEY  hkey,
const WCHAR name,
DWORD reserved,
DWORD type,
void buff,
DWORD buff_len 
)

Definition at line 2101 of file main.c.

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}
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492

Referenced by CFSExtractIcon_CreateInstance(), CQueryAssociations::GetValue(), IsOS(), read_advanced_key(), SH32_CoCreateInstance(), SHELL_ReadSingleUnreadMailCount(), SHGetValueW(), SHRegGetIntW(), SHRegQueryValueExW(), SKAllocValueW(), and SKGetValueW().

◆ SHRegDuplicateHKey()

HKEY WINAPI SHRegDuplicateHKey ( HKEY  hKey)

Definition at line 1828 of file main.c.

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}

Referenced by CRegistrySource::GetKey(), init(), CMruBase::InitData(), CDefaultContextMenu::Initialize(), CRegistrySource::SetKey(), SHRegCreateUSKeyW(), and SHRegOpenUSKeyW().

◆ SHRegGetIntW()

int WINAPI SHRegGetIntW ( HKEY  hkey,
const WCHAR value,
int  default_value 
)

Definition at line 2247 of file main.c.

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}
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752

Referenced by LoadCurrentScheme(), and LoadSchemeFromReg().

◆ SHRegGetPathA()

DWORD WINAPI SHRegGetPathA ( HKEY  hkey,
const char subkey,
const char value,
char path,
DWORD  flags 
)

Definition at line 2268 of file main.c.

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}
DWORD WINAPI SHGetValueA(HKEY hkey, const char *subkey, const char *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2197

Referenced by init().

◆ SHRegGetPathW()

DWORD WINAPI SHRegGetPathW ( HKEY  hkey,
const WCHAR subkey,
const WCHAR value,
WCHAR path,
DWORD  flags 
)

Definition at line 2280 of file main.c.

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}
DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2222

◆ SHRegSetPathA()

DWORD WINAPI SHRegSetPathA ( HKEY  hkey,
const char subkey,
const char value,
const char path,
DWORD  flags 
)

Definition at line 2346 of file main.c.

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}
DWORD WINAPI SHSetValueA(HKEY hkey, const char *subkey, const char *value, DWORD type, const void *data, DWORD data_len)
Definition: main.c:2319
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145

◆ SHRegSetPathW()

DWORD WINAPI SHRegSetPathW ( HKEY  hkey,
const WCHAR subkey,
const WCHAR value,
const WCHAR path,
DWORD  flags 
)

Definition at line 2359 of file main.c.

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}

◆ SHReleaseThreadRef()

HRESULT WINAPI SHReleaseThreadRef ( void  )

Definition at line 1537 of file main.c.

1538{
1539 FIXME("() - stub!\n");
1540 return S_OK;
1541}

◆ SHSetThreadRef()

HRESULT WINAPI SHSetThreadRef ( IUnknown obj)

Definition at line 1523 of file main.c.

1524{
1525 TRACE("(%p)\n", obj);
1526
1528 return E_NOINTERFACE;
1529
1531 return S_OK;
1532}
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1276

◆ SHSetValueA()

DWORD WINAPI SHSetValueA ( HKEY  hkey,
const char subkey,
const char value,
DWORD  type,
const void data,
DWORD  data_len 
)

Definition at line 2319 of file main.c.

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}
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
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

Referenced by RegisterExtensionForMIMETypeA(), RegisterMIMETypeForExtensionA(), and SHRegSetPathA().

◆ SHSetValueW()

◆ SHStrDupA()

HRESULT WINAPI SHStrDupA ( const char src,
WCHAR **  dest 
)

Definition at line 1716 of file main.c.

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}

Referenced by SHCopyKeyA(), SHDeleteEmptyKeyA(), SHDeleteValueA(), SHOpenRegStream2A(), SHOpenRegStreamA(), and TestFilenameA().

◆ SHStrDupW()

◆ shstream_AddRef()

static ULONG WINAPI shstream_AddRef ( IStream iface)
static

Definition at line 574 of file main.c.

575{
576 struct shstream *stream = impl_from_IStream(iface);
578
579 TRACE("%p, refcount %lu.\n", iface, refcount);
580
581 return refcount;
582}
#define InterlockedIncrement
Definition: armddk.h:53

◆ shstream_Clone()

static HRESULT WINAPI shstream_Clone ( IStream iface,
IStream **  dest 
)
static

Definition at line 804 of file main.c.

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}

◆ shstream_Commit()

static HRESULT WINAPI shstream_Commit ( IStream iface,
DWORD  flags 
)
static

Definition at line 752 of file main.c.

753{
754 TRACE("%p, %#lx.\n", iface, flags);
755
756 /* Commit is not supported by this stream */
757 return E_NOTIMPL;
758}

◆ shstream_CopyTo()

static HRESULT WINAPI shstream_CopyTo ( IStream iface,
IStream dest,
ULARGE_INTEGER  size,
ULARGE_INTEGER read_len,
ULARGE_INTEGER written 
)
static

Definition at line 702 of file main.c.

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}
#define E_POINTER
Definition: winerror.h:3480

◆ shstream_create()

static struct shstream * shstream_create ( const IStreamVtbl *  vtbl,
const BYTE data,
UINT  data_len 
)
static

Definition at line 834 of file main.c.

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}

Referenced by SHCreateMemStream(), and SHOpenRegStream2W().

◆ shstream_LockRegion()

static HRESULT WINAPI shstream_LockRegion ( IStream iface,
ULARGE_INTEGER  offset,
ULARGE_INTEGER  size,
DWORD  lock_type 
)
static

Definition at line 770 of file main.c.

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}

◆ shstream_QueryInterface()

static HRESULT WINAPI shstream_QueryInterface ( IStream iface,
REFIID  riid,
void **  out 
)
static

Definition at line 554 of file main.c.

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}
const GUID IID_IUnknown
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ shstream_Revert()

static HRESULT WINAPI shstream_Revert ( IStream iface)
static

Definition at line 760 of file main.c.

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}

◆ shstream_UnlockRegion()

static HRESULT WINAPI shstream_UnlockRegion ( IStream iface,
ULARGE_INTEGER  offset,
ULARGE_INTEGER  size,
DWORD  lock_type 
)
static

Definition at line 780 of file main.c.

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}

◆ SHUnicodeToAnsi()

DWORD WINAPI SHUnicodeToAnsi ( const WCHAR src,
char dest,
int  dest_len 
)

Definition at line 1756 of file main.c.

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}
#define WideCharToMultiByte
Definition: compat.h:111

Referenced by CheckEscapesA(), CDefaultContextMenu::GetCommandString(), GetCommandStringA(), init(), CStartMenuBtnCtxMenu::InvokeCommand(), CDefView::InvokeContextMenuCommand(), MakeShellURLFromPathA(), CAutoComplete::OnNotify(), PathQualifyA(), PathResolveA(), SHBrowseForFolderA(), SHELL_IsVerb(), SHELL_MapContextMenuVerbToCmdId(), SHGetFileDescriptionA(), SHInvokeCommandOnContextMenuInternal(), and ViewDlg_OnInitDialog().

◆ SHUnicodeToUnicode()

DWORD WINAPI SHUnicodeToUnicode ( const WCHAR src,
WCHAR dest,
int  dest_len 
)

Definition at line 1783 of file main.c.

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}
#define lstrcpynW
Definition: compat.h:738

Referenced by init().

◆ SubscribeFeatureStateChangeNotification()

void WINAPI SubscribeFeatureStateChangeNotification ( FEATURE_STATE_CHANGE_SUBSCRIPTION *  subscription,
FEATURE_STATE_CHANGE_CALLBACK callback,
void context 
)

Definition at line 2554 of file main.c.

2556{
2557 FIXME("(%p, %p, %p) stub\n", subscription, callback, context);
2558}
Definition: http.c:7252

◆ threadref_AddRef()

static ULONG WINAPI threadref_AddRef ( IUnknown iface)
static

Definition at line 1445 of file main.c.

1446{
1449
1450 TRACE("%p, refcount %ld.\n", threadref, refcount);
1451
1452 return refcount;
1453}
static struct threadref * threadref_impl_from_IUnknown(IUnknown *iface)
Definition: main.c:1419

◆ threadref_impl_from_IUnknown()

static struct threadref * threadref_impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 1419 of file main.c.

1420{
1421 return CONTAINING_RECORD(iface, struct threadref, IUnknown_iface);
1422}

Referenced by threadref_AddRef(), threadref_QueryInterface(), and threadref_Release().

◆ threadref_QueryInterface()

static HRESULT WINAPI threadref_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  out 
)
static

Definition at line 1424 of file main.c.

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}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ threadref_Release()

static ULONG WINAPI threadref_Release ( IUnknown iface)
static

Definition at line 1455 of file main.c.

1456{
1459
1460 TRACE("%p, refcount %ld.\n", threadref, refcount);
1461
1462 if (!refcount)
1463 free(threadref);
1464
1465 return refcount;
1466}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shcore  )

Variable Documentation

◆ dummyregstream

struct shstream dummyregstream = { { &dummystreamvtbl } }
static

Definition at line 1399 of file main.c.

Referenced by SHOpenRegStreamW().

◆ dummystreamvtbl

const IStreamVtbl dummystreamvtbl
static
Initial value:
=
{
}
static HRESULT WINAPI memstream_Stat(IStream *iface, STATSTG *statstg, DWORD flags)
Definition: main.c:790
static HRESULT WINAPI memstream_SetSize(IStream *iface, ULARGE_INTEGER new_size)
Definition: main.c:682
static HRESULT WINAPI shstream_Commit(IStream *iface, DWORD flags)
Definition: main.c:752
static ULONG WINAPI dummystream_Release(IStream *iface)
Definition: main.c:1367
static ULONG WINAPI dummystream_AddRef(IStream *iface)
Definition: main.c:1361
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 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
static HRESULT WINAPI memstream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *new_pos)
Definition: main.c:655
static HRESULT WINAPI shstream_Clone(IStream *iface, IStream **dest)
Definition: main.c:804
static HRESULT WINAPI dummystream_Read(IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
Definition: main.c:1373
static HRESULT WINAPI shstream_QueryInterface(IStream *iface, REFIID riid, void **out)
Definition: main.c:554
static HRESULT WINAPI shstream_CopyTo(IStream *iface, IStream *dest, ULARGE_INTEGER size, ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
Definition: main.c:702

Definition at line 1381 of file main.c.

◆ filestreamvtbl

const IStreamVtbl filestreamvtbl
static
Initial value:
=
{
}
static HRESULT WINAPI filestream_CopyTo(IStream *iface, IStream *dest, ULARGE_INTEGER size, ULARGE_INTEGER *read_len, ULARGE_INTEGER *written)
Definition: main.c:990
static HRESULT WINAPI filestream_Write(IStream *iface, const void *buff, ULONG size, ULONG *written)
Definition: main.c:919
static HRESULT WINAPI filestream_Commit(IStream *iface, DWORD flags)
Definition: main.c:1033
static HRESULT WINAPI filestream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *new_pos)
Definition: main.c:944
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 ULONG WINAPI shstream_AddRef(IStream *iface)
Definition: main.c:574
static HRESULT WINAPI filestream_SetSize(IStream *iface, ULARGE_INTEGER size)
Definition: main.c:964
static HRESULT WINAPI filestream_Stat(IStream *iface, STATSTG *statstg, DWORD flags)
Definition: main.c:1040

Definition at line 1076 of file main.c.

Referenced by SHCreateStreamOnFileEx().

◆ memstreamvtbl

const IStreamVtbl memstreamvtbl
static
Initial value:
=
{
}
static HRESULT WINAPI memstream_Read(IStream *iface, void *buff, ULONG buff_size, ULONG *read_len)
Definition: main.c:600
static ULONG WINAPI memstream_Release(IStream *iface)
Definition: main.c:584

Definition at line 816 of file main.c.

Referenced by SHCreateMemStream().

◆ process_ref

IUnknown* process_ref
static

Definition at line 41 of file main.c.

Referenced by GetProcessReference(), and SetProcessReference().

◆ regstreamvtbl

const IStreamVtbl regstreamvtbl
static

◆ shcore_tls

DWORD shcore_tls
static

Definition at line 40 of file main.c.

Referenced by DllMain(), SHGetThreadRef(), and SHSetThreadRef().

◆ threadrefvtbl

const IUnknownVtbl threadrefvtbl
static
Initial value:
=
{
}
static ULONG WINAPI threadref_Release(IUnknown *iface)
Definition: main.c:1455
static ULONG WINAPI threadref_AddRef(IUnknown *iface)
Definition: main.c:1445
static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, void **out)
Definition: main.c:1424

Definition at line 1468 of file main.c.

Referenced by SHCreateThreadRef().