ReactOS  0.4.15-dev-5499-g1341c38
source.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "msi.h"
#include "msiquery.h"
#include "msipriv.h"
#include "wincrypt.h"
#include "winver.h"
#include "winuser.h"
#include "sddl.h"
Include dependency graph for source.c:

Go to the source code of this file.

Classes

struct  tagMediaInfo
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct tagMediaInfo media_info
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msi)
 
static UINT OpenSourceKey (LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
 
static UINT OpenMediaSubkey (HKEY rootkey, HKEY *key, BOOL create)
 
static UINT OpenNetworkSubkey (HKEY rootkey, HKEY *key, BOOL create)
 
static UINT OpenURLSubkey (HKEY rootkey, HKEY *key, BOOL create)
 
UINT WINAPI MsiSourceListEnumMediaDisksA (const char *szProductCodeOrPatchCode, const char *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, DWORD *pdwDiskId, char *szVolumeLabel, DWORD *pcchVolumeLabel, char *szDiskPrompt, DWORD *pcchDiskPrompt)
 
UINT WINAPI MsiSourceListEnumMediaDisksW (const WCHAR *szProductCodeOrPatchCode, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, DWORD *pdwDiskId, WCHAR *szVolumeLabel, DWORD *pcchVolumeLabel, WCHAR *szDiskPrompt, DWORD *pcchDiskPrompt)
 
UINT WINAPI MsiSourceListEnumSourcesA (const char *szProductCodeOrPatch, const char *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, char *szSource, DWORD *pcchSource)
 
UINT WINAPI MsiSourceListEnumSourcesW (const WCHAR *szProductCodeOrPatch, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, WCHAR *szSource, DWORD *pcchSource)
 
UINT WINAPI MsiSourceListGetInfoA (LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCSTR szProperty, LPSTR szValue, LPDWORD pcchValue)
 
UINT WINAPI MsiSourceListGetInfoW (LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szProperty, LPWSTR szValue, LPDWORD pcchValue)
 
UINT WINAPI MsiSourceListSetInfoA (LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCSTR szProperty, LPCSTR szValue)
 
UINT msi_set_last_used_source (LPCWSTR product, LPCWSTR usersid, MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value)
 
UINT WINAPI MsiSourceListSetInfoW (const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, const WCHAR *szProperty, const WCHAR *szValue)
 
UINT WINAPI MsiSourceListAddSourceW (LPCWSTR szProduct, LPCWSTR szUserName, DWORD dwReserved, LPCWSTR szSource)
 
UINT WINAPI MsiSourceListAddSourceA (LPCSTR szProduct, LPCSTR szUserName, DWORD dwReserved, LPCSTR szSource)
 
UINT WINAPI MsiSourceListAddSourceExA (LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCSTR szSource, DWORD dwIndex)
 
static void free_source_list (struct list *sourcelist)
 
static void add_source_to_list (struct list *sourcelist, media_info *info, DWORD *index)
 
static UINT fill_source_list (struct list *sourcelist, HKEY sourcekey, DWORD *count)
 
UINT WINAPI MsiSourceListAddSourceExW (const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, const WCHAR *szSource, DWORD dwIndex)
 
UINT WINAPI MsiSourceListAddMediaDiskA (LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, LPCSTR szVolumeLabel, LPCSTR szDiskPrompt)
 
UINT WINAPI MsiSourceListAddMediaDiskW (const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, const WCHAR *szVolumeLabel, const WCHAR *szDiskPrompt)
 
UINT WINAPI MsiSourceListClearAllA (const char *szProduct, const char *szUserName, DWORD dwReserved)
 
UINT WINAPI MsiSourceListClearAllW (const WCHAR *szProduct, const WCHAR *szUserName, DWORD dwReserved)
 
UINT WINAPI MsiSourceListClearAllExA (const char *szProduct, const char *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions)
 
UINT WINAPI MsiSourceListClearAllExW (const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions)
 
UINT WINAPI MsiSourceListClearSourceA (const char *szProductCodeOrPatchCode, const char *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, const char *szSource)
 
UINT WINAPI MsiSourceListClearSourceW (const WCHAR *szProductCodeOrPatchCode, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource)
 
UINT WINAPI MsiSourceListForceResolutionA (const char *product, const char *user, DWORD reserved)
 
UINT WINAPI MsiSourceListForceResolutionW (const WCHAR *product, const WCHAR *user, DWORD reserved)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file source.c.

Typedef Documentation

◆ media_info

Function Documentation

◆ add_source_to_list()

static void add_source_to_list ( struct list sourcelist,
media_info info,
DWORD index 
)
static

Definition at line 947 of file source.c.

949 {
950  media_info *iter;
951  BOOL found = FALSE;
952 
953  if (index) *index = 0;
954 
955  if (list_empty(sourcelist))
956  {
957  list_add_head(sourcelist, &info->entry);
958  return;
959  }
960 
961  LIST_FOR_EACH_ENTRY(iter, sourcelist, media_info, entry)
962  {
963  if (!found && info->index < iter->index)
964  {
965  found = TRUE;
966  list_add_before(&iter->entry, &info->entry);
967  }
968 
969  /* update the rest of the list */
970  if (found)
971  swprintf(iter->szIndex, ARRAY_SIZE(iter->szIndex), L"%d", ++iter->index);
972  else if (index)
973  (*index)++;
974  }
975 
976  if (!found)
977  list_add_after(&iter->entry, &info->entry);
978 }
#define TRUE
Definition: types.h:120
__WINE_SERVER_LIST_INLINE void list_add_after(struct list *elem, struct list *to_add)
Definition: list.h:78
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
DWORD index
Definition: source.c:50
uint32_t entry
Definition: isohybrid.c:63
int _cdecl swprintf(const WCHAR *,...)
WCHAR szIndex[10]
Definition: source.c:49
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
#define ARRAY_SIZE(a)
Definition: main.h:24
struct list entry
Definition: source.c:47
__WINE_SERVER_LIST_INLINE void list_add_before(struct list *elem, struct list *to_add)
Definition: list.h:87
unsigned int index
Definition: notification.c:65

Referenced by fill_source_list(), and MsiSourceListAddSourceExW().

◆ fill_source_list()

static UINT fill_source_list ( struct list sourcelist,
HKEY  sourcekey,
DWORD count 
)
static

Definition at line 980 of file source.c.

981 {
982  UINT r = ERROR_SUCCESS;
983  DWORD index = 0;
984  WCHAR name[10];
985  DWORD size, val_size;
986  media_info *entry;
987 
988  *count = 0;
989 
990  while (r == ERROR_SUCCESS)
991  {
992  size = ARRAY_SIZE(name);
993  r = RegEnumValueW(sourcekey, index, name, &size, NULL, NULL, NULL, &val_size);
994  if (r != ERROR_SUCCESS)
995  return r;
996 
997  entry = msi_alloc(sizeof(media_info));
998  if (!entry)
999  goto error;
1000 
1001  entry->path = msi_alloc(val_size);
1002  if (!entry->path)
1003  {
1004  msi_free(entry);
1005  goto error;
1006  }
1007 
1008  lstrcpyW(entry->szIndex, name);
1009  entry->index = wcstol(name, NULL, 10);
1010 
1011  size++;
1012  r = RegEnumValueW(sourcekey, index, name, &size, NULL,
1013  NULL, (LPBYTE)entry->path, &val_size);
1014  if (r != ERROR_SUCCESS)
1015  {
1016  msi_free(entry->path);
1017  msi_free(entry);
1018  goto error;
1019  }
1020 
1021  index = ++(*count);
1022  add_source_to_list(sourcelist, entry, NULL);
1023  }
1024 
1025 error:
1026  *count = -1;
1027  free_source_list(sourcelist);
1028  return ERROR_OUTOFMEMORY;
1029 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void add_source_to_list(struct list *sourcelist, media_info *info, DWORD *index)
Definition: source.c:947
static void msi_free(void *mem)
Definition: msipriv.h:1159
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
unsigned char * LPBYTE
Definition: typedefs.h:53
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:2853
GLuint index
Definition: glext.h:6031
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t entry
Definition: isohybrid.c:63
static void free_source_list(struct list *sourcelist)
Definition: source.c:936
#define lstrcpyW
Definition: compat.h:749
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
Definition: name.c:38
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by MsiSourceListAddSourceExW().

◆ free_source_list()

static void free_source_list ( struct list sourcelist)
static

Definition at line 936 of file source.c.

937 {
938  while (!list_empty(sourcelist))
939  {
941  list_remove(&info->entry);
942  msi_free(info->path);
943  msi_free(info);
944  }
945 }
static void msi_free(void *mem)
Definition: msipriv.h:1159
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
uint32_t entry
Definition: isohybrid.c:63
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by fill_source_list(), and MsiSourceListAddSourceExW().

◆ msi_set_last_used_source()

UINT msi_set_last_used_source ( LPCWSTR  product,
LPCWSTR  usersid,
MSIINSTALLCONTEXT  context,
DWORD  options,
LPCWSTR  value 
)

Definition at line 686 of file source.c.

689 {
690  HKEY source;
691  LPWSTR buffer;
692  WCHAR typechar;
693  DWORD size;
694  UINT r;
695  int index = 1;
696 
698  typechar = 'n';
699  else if (options & MSISOURCETYPE_URL)
700  typechar = 'u';
701  else if (options & MSISOURCETYPE_MEDIA)
702  typechar = 'm';
703  else
705 
706  if (!(options & MSISOURCETYPE_MEDIA))
707  {
708  r = MsiSourceListAddSourceExW(product, usersid, context,
709  options, value, 0);
710  if (r != ERROR_SUCCESS)
711  return r;
712 
713  index = 0;
714  while ((r = MsiSourceListEnumSourcesW(product, usersid, context, options,
715  index, NULL, NULL)) == ERROR_SUCCESS)
716  index++;
717 
718  if (r != ERROR_NO_MORE_ITEMS)
719  return r;
720  }
721 
722  size = lstrlenW(L"%c;%d;%s") + lstrlenW(value) + 7;
723  buffer = msi_alloc(size * sizeof(WCHAR));
724  if (!buffer)
725  return ERROR_OUTOFMEMORY;
726 
728  if (r != ERROR_SUCCESS)
729  {
730  msi_free(buffer);
731  return r;
732  }
733 
734  swprintf(buffer, size, L"%c;%d;%s", typechar, index, value);
735 
736  size = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
738  REG_SZ, (LPBYTE)buffer, size);
739  msi_free(buffer);
740 
742  return r;
743 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
Definition: pdh_main.c:93
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
Definition: http.c:7251
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define lstrlenW
Definition: compat.h:750
static const WCHAR INSTALLPROPERTY_LASTUSEDSOURCEW[]
Definition: msi.h:405
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:53
#define L(x)
Definition: ntvdm.h:50
UINT WINAPI MsiSourceListEnumSourcesW(const WCHAR *szProductCodeOrPatch, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, WCHAR *szSource, DWORD *pcchSource)
Definition: source.c:398
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
GLuint index
Definition: glext.h:6031
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:4899
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int _cdecl swprintf(const WCHAR *,...)
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT WINAPI MsiSourceListAddSourceExW(const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, const WCHAR *szSource, DWORD dwIndex)
Definition: source.c:1034
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define REG_SZ
Definition: layer.c:22

Referenced by msi_publish_sourcelist(), and MsiSourceListSetInfoW().

◆ MsiSourceListAddMediaDiskA()

UINT WINAPI MsiSourceListAddMediaDiskA ( LPCSTR  szProduct,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwDiskId,
LPCSTR  szVolumeLabel,
LPCSTR  szDiskPrompt 
)

Definition at line 1157 of file source.c.

1160 {
1161  UINT r;
1162  LPWSTR product = NULL;
1163  LPWSTR usersid = NULL;
1164  LPWSTR volume = NULL;
1165  LPWSTR prompt = NULL;
1166 
1167  if (szProduct) product = strdupAtoW(szProduct);
1168  if (szUserSid) usersid = strdupAtoW(szUserSid);
1169  if (szVolumeLabel) volume = strdupAtoW(szVolumeLabel);
1170  if (szDiskPrompt) prompt = strdupAtoW(szDiskPrompt);
1171 
1172  r = MsiSourceListAddMediaDiskW(product, usersid, dwContext, dwOptions,
1173  dwDiskId, volume, prompt);
1174 
1175  msi_free(product);
1176  msi_free(usersid);
1177  msi_free(volume);
1178  msi_free(prompt);
1179 
1180  return r;
1181 }
DWORD dwOptions
Definition: solitaire.cpp:24
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void msi_free(void *mem)
Definition: msipriv.h:1159
UINT WINAPI MsiSourceListAddMediaDiskW(const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, const WCHAR *szVolumeLabel, const WCHAR *szDiskPrompt)
Definition: source.c:1186
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65

Referenced by init_functionpointers().

◆ MsiSourceListAddMediaDiskW()

UINT WINAPI MsiSourceListAddMediaDiskW ( const WCHAR szProduct,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwDiskId,
const WCHAR szVolumeLabel,
const WCHAR szDiskPrompt 
)

Definition at line 1186 of file source.c.

1189 {
1190  HKEY sourcekey, mediakey;
1191  UINT rc;
1192  WCHAR *buffer, squashed_pc[SQUASHED_GUID_SIZE], szIndex[10];
1193  DWORD size;
1194 
1195  TRACE( "%s, %s, %d, %#lx, %lu, %s, %s\n", debugstr_w(szProduct), debugstr_w(szUserSid), dwContext, dwOptions,
1196  dwDiskId, debugstr_w(szVolumeLabel), debugstr_w(szDiskPrompt) );
1197 
1198  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
1199  return ERROR_INVALID_PARAMETER;
1200 
1202  return ERROR_INVALID_PARAMETER;
1203 
1204  if ((szVolumeLabel && !*szVolumeLabel) || (szDiskPrompt && !*szDiskPrompt))
1205  return ERROR_INVALID_PARAMETER;
1206 
1207  if ((dwContext & MSIINSTALLCONTEXT_MACHINE) && szUserSid)
1208  return ERROR_INVALID_PARAMETER;
1209 
1210  if (dwOptions & MSICODE_PATCH)
1211  {
1212  FIXME("Unhandled options MSICODE_PATCH\n");
1213  return ERROR_FUNCTION_FAILED;
1214  }
1215 
1216  rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
1217  if (rc != ERROR_SUCCESS)
1218  return rc;
1219 
1220  OpenMediaSubkey(sourcekey, &mediakey, TRUE);
1221 
1222  swprintf(szIndex, ARRAY_SIZE(szIndex), L"%d", dwDiskId);
1223 
1224  size = 2;
1225  if (szVolumeLabel) size += lstrlenW(szVolumeLabel);
1226  if (szDiskPrompt) size += lstrlenW(szDiskPrompt);
1227 
1228  size *= sizeof(WCHAR);
1229  buffer = msi_alloc(size);
1230  *buffer = '\0';
1231 
1232  if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel);
1233  lstrcatW(buffer, L";");
1234  if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt);
1235 
1236  RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size);
1237  msi_free(buffer);
1238 
1239  RegCloseKey(sourcekey);
1240  RegCloseKey(mediakey);
1241 
1242  return ERROR_SUCCESS;
1243 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define lstrlenW
Definition: compat.h:750
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:53
#define L(x)
Definition: ntvdm.h:50
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
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:4899
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int _cdecl swprintf(const WCHAR *,...)
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
#define lstrcpyW
Definition: compat.h:749
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:86
unsigned int UINT
Definition: ndis.h:50
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_SZ
Definition: layer.c:22

Referenced by msi_publish_sourcelist(), and MsiSourceListAddMediaDiskA().

◆ MsiSourceListAddSourceA()

UINT WINAPI MsiSourceListAddSourceA ( LPCSTR  szProduct,
LPCSTR  szUserName,
DWORD  dwReserved,
LPCSTR  szSource 
)

Definition at line 892 of file source.c.

894 {
895  INT ret;
896  LPWSTR szwproduct;
897  LPWSTR szwusername;
898  LPWSTR szwsource;
899 
900  szwproduct = strdupAtoW( szProduct );
901  szwusername = strdupAtoW( szUserName );
902  szwsource = strdupAtoW( szSource );
903 
904  ret = MsiSourceListAddSourceW(szwproduct, szwusername, dwReserved, szwsource);
905 
906  msi_free(szwproduct);
907  msi_free(szwusername);
908  msi_free(szwsource);
909 
910  return ret;
911 }
static void msi_free(void *mem)
Definition: msipriv.h:1159
int32_t INT
Definition: typedefs.h:58
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
int ret
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT WINAPI MsiSourceListAddSourceW(LPCWSTR szProduct, LPCWSTR szUserName, DWORD dwReserved, LPCWSTR szSource)
Definition: source.c:828
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65

Referenced by init_functionpointers().

◆ MsiSourceListAddSourceExA()

UINT WINAPI MsiSourceListAddSourceExA ( LPCSTR  szProduct,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
LPCSTR  szSource,
DWORD  dwIndex 
)

Definition at line 916 of file source.c.

918 {
919  UINT ret;
920  LPWSTR product, usersid, source;
921 
922  product = strdupAtoW(szProduct);
923  usersid = strdupAtoW(szUserSid);
924  source = strdupAtoW(szSource);
925 
926  ret = MsiSourceListAddSourceExW(product, usersid, dwContext,
927  dwOptions, source, dwIndex);
928 
929  msi_free(product);
930  msi_free(usersid);
931  msi_free(source);
932 
933  return ret;
934 }
DWORD dwOptions
Definition: solitaire.cpp:24
static void msi_free(void *mem)
Definition: msipriv.h:1159
int ret
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI MsiSourceListAddSourceExW(const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, const WCHAR *szSource, DWORD dwIndex)
Definition: source.c:1034
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65

Referenced by init_functionpointers().

◆ MsiSourceListAddSourceExW()

UINT WINAPI MsiSourceListAddSourceExW ( const WCHAR szProduct,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
const WCHAR szSource,
DWORD  dwIndex 
)

Definition at line 1034 of file source.c.

1036 {
1037  HKEY sourcekey, typekey;
1038  UINT rc;
1039  struct list sourcelist;
1040  media_info *info;
1041  WCHAR *source, squashed_pc[SQUASHED_GUID_SIZE], name[10];
1042  LPCWSTR postfix;
1043  DWORD size, count, index;
1044 
1045  TRACE( "%s, %s, %d, %#lx, %s, %lu\n", debugstr_w(szProduct), debugstr_w(szUserSid), dwContext, dwOptions,
1046  debugstr_w(szSource), dwIndex );
1047 
1048  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
1049  return ERROR_INVALID_PARAMETER;
1050 
1051  if (!szSource || !*szSource)
1052  return ERROR_INVALID_PARAMETER;
1053 
1055  return ERROR_INVALID_PARAMETER;
1056 
1057  if (dwOptions & MSICODE_PATCH)
1058  {
1059  FIXME("Unhandled options MSICODE_PATCH\n");
1060  return ERROR_FUNCTION_FAILED;
1061  }
1062 
1063  if (szUserSid && (dwContext & MSIINSTALLCONTEXT_MACHINE))
1064  return ERROR_INVALID_PARAMETER;
1065 
1066  rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
1067  if (rc != ERROR_SUCCESS)
1068  return rc;
1069 
1071  rc = OpenNetworkSubkey(sourcekey, &typekey, TRUE);
1072  else if (dwOptions & MSISOURCETYPE_URL)
1073  rc = OpenURLSubkey(sourcekey, &typekey, TRUE);
1074  else if (dwOptions & MSISOURCETYPE_MEDIA)
1075  rc = OpenMediaSubkey(sourcekey, &typekey, TRUE);
1076  else
1077  {
1078  ERR( "unknown media type: %#lx\n", dwOptions );
1079  RegCloseKey(sourcekey);
1080  return ERROR_FUNCTION_FAILED;
1081  }
1082  if (rc != ERROR_SUCCESS)
1083  {
1084  ERR("can't open subkey %u\n", rc);
1085  RegCloseKey(sourcekey);
1086  return rc;
1087  }
1088 
1089  postfix = (dwOptions & MSISOURCETYPE_NETWORK) ? L"\\" : L"/";
1090  if (szSource[lstrlenW(szSource) - 1] == *postfix)
1091  source = strdupW(szSource);
1092  else
1093  {
1094  size = lstrlenW(szSource) + 2;
1095  source = msi_alloc(size * sizeof(WCHAR));
1096  lstrcpyW(source, szSource);
1097  lstrcatW(source, postfix);
1098  }
1099 
1100  list_init(&sourcelist);
1101  rc = fill_source_list(&sourcelist, typekey, &count);
1102  if (rc != ERROR_NO_MORE_ITEMS)
1103  goto done;
1104 
1105  size = (lstrlenW(source) + 1) * sizeof(WCHAR);
1106 
1107  if (count == 0)
1108  {
1109  rc = RegSetValueExW(typekey, L"1", 0, REG_EXPAND_SZ, (LPBYTE)source, size);
1110  goto done;
1111  }
1112  else if (dwIndex > count || dwIndex == 0)
1113  {
1114  swprintf(name, ARRAY_SIZE(name), L"%d", count + 1);
1115  rc = RegSetValueExW(typekey, name, 0, REG_EXPAND_SZ, (LPBYTE)source, size);
1116  goto done;
1117  }
1118  else
1119  {
1120  swprintf(name, ARRAY_SIZE(name), L"%d", dwIndex);
1121  info = msi_alloc(sizeof(media_info));
1122  if (!info)
1123  {
1124  rc = ERROR_OUTOFMEMORY;
1125  goto done;
1126  }
1127 
1128  info->path = strdupW(source);
1129  lstrcpyW(info->szIndex, name);
1130  info->index = dwIndex;
1131  add_source_to_list(&sourcelist, info, &index);
1132 
1133  LIST_FOR_EACH_ENTRY(info, &sourcelist, media_info, entry)
1134  {
1135  if (info->index < index)
1136  continue;
1137 
1138  size = (lstrlenW(info->path) + 1) * sizeof(WCHAR);
1139  rc = RegSetValueExW(typekey, info->szIndex, 0,
1140  REG_EXPAND_SZ, (LPBYTE)info->path, size);
1141  if (rc != ERROR_SUCCESS)
1142  goto done;
1143  }
1144  }
1145 
1146 done:
1147  free_source_list(&sourcelist);
1148  msi_free(source);
1149  RegCloseKey(typekey);
1150  RegCloseKey(sourcekey);
1151  return rc;
1152 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define TRUE
Definition: types.h:120
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void add_source_to_list(struct list *sourcelist, media_info *info, DWORD *index)
Definition: source.c:947
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define lstrlenW
Definition: compat.h:750
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:53
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define L(x)
Definition: ntvdm.h:50
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
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:4899
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *count)
Definition: source.c:980
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
int _cdecl swprintf(const WCHAR *,...)
static void free_source_list(struct list *sourcelist)
Definition: source.c:936
static UINT OpenNetworkSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:117
#define ERR(fmt,...)
Definition: debug.h:110
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
#define lstrcpyW
Definition: compat.h:749
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:86
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
unsigned int UINT
Definition: ndis.h:50
static UINT OpenURLSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:129
Definition: name.c:38
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define RegCloseKey(hKey)
Definition: registry.h:47
unsigned int index
Definition: notification.c:65
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by msi_set_last_used_source(), MsiSourceListAddSourceExA(), and MsiSourceListAddSourceW().

◆ MsiSourceListAddSourceW()

UINT WINAPI MsiSourceListAddSourceW ( LPCWSTR  szProduct,
LPCWSTR  szUserName,
DWORD  dwReserved,
LPCWSTR  szSource 
)

Definition at line 828 of file source.c.

830 {
831  WCHAR *sidstr = NULL, squashed_pc[SQUASHED_GUID_SIZE];
832  INT ret;
833  DWORD sidsize = 0, domsize = 0, context;
834  HKEY hkey = 0;
835  UINT r;
836 
837  TRACE("%s %s %s\n", debugstr_w(szProduct), debugstr_w(szUserName), debugstr_w(szSource));
838 
839  if (!szSource || !*szSource)
841 
842  if (dwReserved != 0)
844 
845  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
847 
848  if (!szUserName || !*szUserName)
850  else
851  {
852  if (LookupAccountNameW(NULL, szUserName, NULL, &sidsize, NULL, &domsize, NULL))
853  {
854  PSID psid = msi_alloc(sidsize);
855 
856  if (LookupAccountNameW(NULL, szUserName, psid, &sidsize, NULL, &domsize, NULL))
857  ConvertSidToStringSidW(psid, &sidstr);
858 
859  msi_free(psid);
860  }
861 
862  r = MSIREG_OpenProductKey(szProduct, NULL,
864  if (r == ERROR_SUCCESS)
866  else
867  {
868  r = MSIREG_OpenProductKey(szProduct, NULL,
870  &hkey, FALSE);
871  if (r != ERROR_SUCCESS)
872  return ERROR_UNKNOWN_PRODUCT;
873 
875  }
876 
877  RegCloseKey(hkey);
878  }
879 
880  ret = MsiSourceListAddSourceExW(szProduct, sidstr,
881  context, MSISOURCETYPE_NETWORK, szSource, 0);
882 
883  if (sidstr)
884  LocalFree(sidstr);
885 
886  return ret;
887 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: http.c:7251
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void msi_free(void *mem)
Definition: msipriv.h:1159
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3382
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define debugstr_w
Definition: kernel32.h:32
UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:338
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ERROR_UNKNOWN_PRODUCT
Definition: winerror.h:963
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PVOID _In_ ULONG _In_ PVOID context
Definition: wdfdriver.h:113
int ret
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:86
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT WINAPI MsiSourceListAddSourceExW(const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, const WCHAR *szSource, DWORD dwIndex)
Definition: source.c:1034
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
BOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse)
Definition: misc.c:626
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by MsiSourceListAddSourceA().

◆ MsiSourceListClearAllA()

UINT WINAPI MsiSourceListClearAllA ( const char szProduct,
const char szUserName,
DWORD  dwReserved 
)

Definition at line 1248 of file source.c.

1249 {
1250  FIXME( "%s, %s, %#lx\n", debugstr_a(szProduct), debugstr_a(szUserName), dwReserved );
1251  return ERROR_SUCCESS;
1252 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31

◆ MsiSourceListClearAllExA()

UINT WINAPI MsiSourceListClearAllExA ( const char szProduct,
const char szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions 
)

Definition at line 1266 of file source.c.

1268 {
1269  FIXME( "%s, %s, %d, %#lx\n", debugstr_a(szProduct), debugstr_a(szUserSid), dwContext, dwOptions );
1270  return ERROR_SUCCESS;
1271 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31

◆ MsiSourceListClearAllExW()

UINT WINAPI MsiSourceListClearAllExW ( const WCHAR szProduct,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions 
)

Definition at line 1276 of file source.c.

1278 {
1279  FIXME( "%s, %s, %d, %#lx\n", debugstr_w(szProduct), debugstr_w(szUserSid), dwContext, dwOptions );
1280  return ERROR_SUCCESS;
1281 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111

◆ MsiSourceListClearAllW()

UINT WINAPI MsiSourceListClearAllW ( const WCHAR szProduct,
const WCHAR szUserName,
DWORD  dwReserved 
)

Definition at line 1257 of file source.c.

1258 {
1259  FIXME( "%s, %s, %#lx\n", debugstr_w(szProduct), debugstr_w(szUserName), dwReserved );
1260  return ERROR_SUCCESS;
1261 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111

◆ MsiSourceListClearSourceA()

UINT WINAPI MsiSourceListClearSourceA ( const char szProductCodeOrPatchCode,
const char szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
const char szSource 
)

Definition at line 1286 of file source.c.

1288 {
1289  FIXME( "%s, %s, %d, %#lx, %s\n", debugstr_a(szProductCodeOrPatchCode), debugstr_a(szUserSid), dwContext,
1290  dwOptions, debugstr_a(szSource) );
1291  return ERROR_SUCCESS;
1292 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31

◆ MsiSourceListClearSourceW()

UINT WINAPI MsiSourceListClearSourceW ( const WCHAR szProductCodeOrPatchCode,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
LPCWSTR  szSource 
)

Definition at line 1297 of file source.c.

1299 {
1300  FIXME( "%s, %s, %d, %#lx, %s\n", debugstr_w(szProductCodeOrPatchCode), debugstr_w(szUserSid), dwContext,
1301  dwOptions, debugstr_w(szSource) );
1302  return ERROR_SUCCESS;
1303 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111

◆ MsiSourceListEnumMediaDisksA()

UINT WINAPI MsiSourceListEnumMediaDisksA ( const char szProductCodeOrPatchCode,
const char szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
DWORD pdwDiskId,
char szVolumeLabel,
DWORD pcchVolumeLabel,
char szDiskPrompt,
DWORD pcchDiskPrompt 
)

Definition at line 144 of file source.c.

148 {
149  WCHAR *product = NULL, *usersid = NULL, *volume = NULL, *prompt = NULL;
151 
152  TRACE( "%s, %s, %d, %#lx, %lu, %p, %p, %p, %p, %p\n", debugstr_a(szProductCodeOrPatchCode),
153  debugstr_a(szUserSid), dwContext, dwOptions, dwIndex, pdwDiskId, szVolumeLabel, pcchVolumeLabel,
154  szDiskPrompt, pcchDiskPrompt );
155 
156  if (szDiskPrompt && !pcchDiskPrompt)
158 
159  if (szProductCodeOrPatchCode) product = strdupAtoW(szProductCodeOrPatchCode);
160  if (szUserSid) usersid = strdupAtoW(szUserSid);
161 
162  /* FIXME: add tests for an invalid format */
163 
164  if (pcchVolumeLabel)
165  volume = msi_alloc(*pcchVolumeLabel * sizeof(WCHAR));
166 
167  if (pcchDiskPrompt)
168  prompt = msi_alloc(*pcchDiskPrompt * sizeof(WCHAR));
169 
170  if (volume) *volume = '\0';
171  if (prompt) *prompt = '\0';
172  r = MsiSourceListEnumMediaDisksW(product, usersid, dwContext, dwOptions,
173  dwIndex, pdwDiskId, volume, pcchVolumeLabel,
174  prompt, pcchDiskPrompt);
175  if (r != ERROR_SUCCESS)
176  goto done;
177 
178  if (szVolumeLabel && pcchVolumeLabel)
179  WideCharToMultiByte(CP_ACP, 0, volume, -1, szVolumeLabel,
180  *pcchVolumeLabel + 1, NULL, NULL);
181 
182  if (szDiskPrompt)
183  WideCharToMultiByte(CP_ACP, 0, prompt, -1, szDiskPrompt,
184  *pcchDiskPrompt + 1, NULL, NULL);
185 
186 done:
187  msi_free(product);
188  msi_free(usersid);
189  msi_free(volume);
190  msi_free(prompt);
191 
192  return r;
193 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:111
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:109
UINT WINAPI MsiSourceListEnumMediaDisksW(const WCHAR *szProductCodeOrPatchCode, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, DWORD *pdwDiskId, WCHAR *szVolumeLabel, DWORD *pcchVolumeLabel, WCHAR *szDiskPrompt, DWORD *pcchDiskPrompt)
Definition: source.c:198
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65

Referenced by init_functionpointers().

◆ MsiSourceListEnumMediaDisksW()

UINT WINAPI MsiSourceListEnumMediaDisksW ( const WCHAR szProductCodeOrPatchCode,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
DWORD pdwDiskId,
WCHAR szVolumeLabel,
DWORD pcchVolumeLabel,
WCHAR szDiskPrompt,
DWORD pcchDiskPrompt 
)

Definition at line 198 of file source.c.

202 {
203  WCHAR squashed_pc[SQUASHED_GUID_SIZE], convert[11];
204  WCHAR *value = NULL, *data = NULL, *ptr, *ptr2;
205  HKEY source, media;
206  DWORD valuesz, datasz = 0, type, numvals, size;
207  LONG res;
208  UINT r;
209  static DWORD index = 0;
210 
211  TRACE( "%s, %s, %d, %#lx, %lu, %p, %p, %p, %p\n", debugstr_w(szProductCodeOrPatchCode),
212  debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel, pcchVolumeLabel,
213  szDiskPrompt, pcchDiskPrompt );
214 
215  if (!szProductCodeOrPatchCode || !squash_guid( szProductCodeOrPatchCode, squashed_pc ))
217 
218  if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
220 
223 
224  if (szDiskPrompt && !pcchDiskPrompt)
226 
227  if (dwIndex == 0)
228  index = 0;
229 
230  if (dwIndex != index)
232 
233  r = OpenSourceKey(szProductCodeOrPatchCode, &source, dwOptions, dwContext, FALSE);
234  if (r != ERROR_SUCCESS)
235  return r;
236 
238  if (r != ERROR_SUCCESS)
239  {
241  return ERROR_NO_MORE_ITEMS;
242  }
243 
245  NULL, &numvals, &valuesz, &datasz, NULL, NULL);
246  if (res != ERROR_SUCCESS)
247  {
249  goto done;
250  }
251 
252  value = msi_alloc(++valuesz * sizeof(WCHAR));
253  data = msi_alloc(++datasz * sizeof(WCHAR));
254  if (!value || !data)
255  {
257  goto done;
258  }
259 
260  r = RegEnumValueW(media, dwIndex, value, &valuesz,
261  NULL, &type, (LPBYTE)data, &datasz);
262  if (r != ERROR_SUCCESS)
263  goto done;
264 
265  if (pdwDiskId)
266  *pdwDiskId = wcstol(value, NULL, 10);
267 
268  ptr2 = data;
269  ptr = wcschr(data, ';');
270  if (!ptr)
271  ptr = data;
272  else
273  *ptr = '\0';
274 
275  if (pcchVolumeLabel)
276  {
277  if (type == REG_DWORD)
278  {
280  size = lstrlenW(convert);
281  ptr2 = convert;
282  }
283  else
284  size = lstrlenW(data);
285 
286  if (size >= *pcchVolumeLabel)
287  r = ERROR_MORE_DATA;
288  else if (szVolumeLabel)
289  lstrcpyW(szVolumeLabel, ptr2);
290 
291  *pcchVolumeLabel = size;
292  }
293 
294  if (pcchDiskPrompt)
295  {
296  if (!*ptr)
297  ptr++;
298 
299  if (type == REG_DWORD)
300  {
301  swprintf(convert, ARRAY_SIZE(convert), L"#%d", *ptr);
302  size = lstrlenW(convert);
303  ptr = convert;
304  }
305  else
306  size = lstrlenW(ptr);
307 
308  if (size >= *pcchDiskPrompt)
309  r = ERROR_MORE_DATA;
310  else if (szDiskPrompt)
311  lstrcpyW(szDiskPrompt, ptr);
312 
313  *pcchDiskPrompt = size;
314  }
315 
316  index++;
317 
318 done:
319  msi_free(value);
320  msi_free(data);
322 
323  return r;
324 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
Definition: pdh_main.c:93
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void msi_free(void *mem)
Definition: msipriv.h:1159
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define lstrlenW
Definition: compat.h:750
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:53
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
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:2853
GLuint index
Definition: glext.h:6031
__u8 media
Definition: mkdosfs.c:367
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
#define ERROR_BAD_CONFIGURATION
Definition: winerror.h:968
int convert
Definition: msacm.c:1374
static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
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:3690
int _cdecl swprintf(const WCHAR *,...)
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
#define lstrcpyW
Definition: compat.h:749
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:86
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_DWORD
Definition: sdbapi.c:596
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by find_published_source(), and MsiSourceListEnumMediaDisksA().

◆ MsiSourceListEnumSourcesA()

UINT WINAPI MsiSourceListEnumSourcesA ( const char szProductCodeOrPatch,
const char szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
char szSource,
DWORD pcchSource 
)

Definition at line 329 of file source.c.

332 {
333  WCHAR *product = NULL, *usersid = NULL, *source = NULL;
334  DWORD len = 0;
336  static DWORD index = 0;
337 
338  TRACE( "%s, %s, %d, %#lx, %lu, %p, %p)\n", debugstr_a(szProductCodeOrPatch), debugstr_a(szUserSid), dwContext,
339  dwOptions, dwIndex, szSource, pcchSource );
340 
341  if (dwIndex == 0)
342  index = 0;
343 
344  if (szSource && !pcchSource)
345  goto done;
346 
347  if (dwIndex != index)
348  goto done;
349 
350  if (szProductCodeOrPatch) product = strdupAtoW(szProductCodeOrPatch);
351  if (szUserSid) usersid = strdupAtoW(szUserSid);
352 
353  r = MsiSourceListEnumSourcesW(product, usersid, dwContext, dwOptions,
354  dwIndex, NULL, &len);
355  if (r != ERROR_SUCCESS)
356  goto done;
357 
358  source = msi_alloc(++len * sizeof(WCHAR));
359  if (!source)
360  {
362  goto done;
363  }
364 
365  *source = '\0';
366  r = MsiSourceListEnumSourcesW(product, usersid, dwContext, dwOptions,
367  dwIndex, source, &len);
368  if (r != ERROR_SUCCESS)
369  goto done;
370 
371  len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
372  if (pcchSource && *pcchSource >= len)
373  WideCharToMultiByte(CP_ACP, 0, source, -1, szSource, len, NULL, NULL);
374  else if (szSource)
375  r = ERROR_MORE_DATA;
376 
377  if (pcchSource)
378  *pcchSource = len - 1;
379 
380 done:
381  msi_free(product);
382  msi_free(usersid);
383  msi_free(source);
384 
385  if (r == ERROR_SUCCESS)
386  {
387  if (szSource || !pcchSource) index++;
388  }
389  else if (dwIndex > index)
390  index = 0;
391 
392  return r;
393 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:111
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:109
static void msi_free(void *mem)
Definition: msipriv.h:1159
UINT WINAPI MsiSourceListEnumSourcesW(const WCHAR *szProductCodeOrPatch, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, WCHAR *szSource, DWORD *pcchSource)
Definition: source.c:398
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by init_functionpointers().

◆ MsiSourceListEnumSourcesW()

UINT WINAPI MsiSourceListEnumSourcesW ( const WCHAR szProductCodeOrPatch,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
WCHAR szSource,
DWORD pcchSource 
)

Definition at line 398 of file source.c.

401 {
402  WCHAR squashed_pc[SQUASHED_GUID_SIZE], name[32];
403  HKEY source = NULL, subkey = NULL;
404  LONG res;
406  static DWORD index = 0;
407 
408  TRACE( "%s, %s, %d, %#lx, %lu, %p, %p\n", debugstr_w(szProductCodeOrPatch), debugstr_w(szUserSid), dwContext,
409  dwOptions, dwIndex, szSource, pcchSource );
410 
411  if (dwIndex == 0)
412  index = 0;
413 
414  if (!szProductCodeOrPatch || !squash_guid( szProductCodeOrPatch, squashed_pc ))
415  goto done;
416 
417  if (szSource && !pcchSource)
418  goto done;
419 
421  goto done;
422 
424  goto done;
425 
426  if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
427  goto done;
428 
429  if (dwIndex != index)
430  goto done;
431 
432  r = OpenSourceKey( szProductCodeOrPatch, &source, dwOptions, dwContext, FALSE );
433  if (r != ERROR_SUCCESS)
434  goto done;
435 
437  r = OpenNetworkSubkey(source, &subkey, FALSE);
438  else if (dwOptions & MSISOURCETYPE_URL)
439  r = OpenURLSubkey(source, &subkey, FALSE);
440 
441  if (r != ERROR_SUCCESS)
442  {
444  goto done;
445  }
446 
447  swprintf(name, ARRAY_SIZE(name), L"%d", dwIndex + 1);
448 
449  res = RegQueryValueExW(subkey, name, 0, 0, (LPBYTE)szSource, pcchSource);
450  if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
452 
453 done:
454  RegCloseKey(subkey);
456 
457  if (r == ERROR_SUCCESS)
458  {
459  if (szSource || !pcchSource) index++;
460  }
461  else if (dwIndex > index)
462  index = 0;
463 
464  return r;
465 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:53
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int _cdecl swprintf(const WCHAR *,...)
static UINT OpenNetworkSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:117
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
#define ARRAY_SIZE(a)
Definition: main.h:24
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:86
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static UINT OpenURLSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:129
Definition: name.c:38
GLuint res
Definition: glext.h:9613
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by find_published_source(), msi_set_last_used_source(), and MsiSourceListEnumSourcesA().

◆ MsiSourceListForceResolutionA()

UINT WINAPI MsiSourceListForceResolutionA ( const char product,
const char user,
DWORD  reserved 
)

Definition at line 1308 of file source.c.

1309 {
1310  FIXME( "%s, %s, %#lx\n", debugstr_a(product), debugstr_a(user), reserved );
1311  return ERROR_SUCCESS;
1312 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:111
r reserved
Definition: btrfs.c:3006
#define debugstr_a
Definition: kernel32.h:31
void user(int argc, const char *argv[])
Definition: cmds.c:1350

◆ MsiSourceListForceResolutionW()

UINT WINAPI MsiSourceListForceResolutionW ( const WCHAR product,
const WCHAR user,
DWORD  reserved 
)

Definition at line 1317 of file source.c.

1318 {
1319  FIXME( "%s, %s, %#lx\n", debugstr_w(product), debugstr_w(user), reserved );
1320  return ERROR_SUCCESS;
1321 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
r reserved
Definition: btrfs.c:3006
void user(int argc, const char *argv[])
Definition: cmds.c:1350

◆ MsiSourceListGetInfoA()

UINT WINAPI MsiSourceListGetInfoA ( LPCSTR  szProduct,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
LPCSTR  szProperty,
LPSTR  szValue,
LPDWORD  pcchValue 
)

Definition at line 470 of file source.c.

474 {
475  UINT ret;
476  LPWSTR product = NULL;
477  LPWSTR usersid = NULL;
478  LPWSTR property = NULL;
479  LPWSTR value = NULL;
480  DWORD len = 0;
481 
482  if (szValue && !pcchValue)
484 
485  if (szProduct) product = strdupAtoW(szProduct);
486  if (szUserSid) usersid = strdupAtoW(szUserSid);
487  if (szProperty) property = strdupAtoW(szProperty);
488 
489  ret = MsiSourceListGetInfoW(product, usersid, dwContext, dwOptions,
490  property, NULL, &len);
491  if (ret != ERROR_SUCCESS)
492  goto done;
493 
494  value = msi_alloc(++len * sizeof(WCHAR));
495  if (!value)
496  return ERROR_OUTOFMEMORY;
497 
498  *value = '\0';
499  ret = MsiSourceListGetInfoW(product, usersid, dwContext, dwOptions,
500  property, value, &len);
501  if (ret != ERROR_SUCCESS)
502  goto done;
503 
504  len = WideCharToMultiByte(CP_ACP, 0, value, -1, NULL, 0, NULL, NULL);
505  if (*pcchValue >= len)
506  WideCharToMultiByte(CP_ACP, 0, value, -1, szValue, len, NULL, NULL);
507  else if (szValue)
509 
510  *pcchValue = len - 1;
511 
512 done:
513  msi_free(product);
514  msi_free(usersid);
516  msi_free(value);
517  return ret;
518 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
Definition: pdh_main.c:93
UINT WINAPI MsiSourceListGetInfoW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szProperty, LPWSTR szValue, LPDWORD pcchValue)
Definition: source.c:523
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
static void msi_free(void *mem)
Definition: msipriv.h:1159
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by init_functionpointers().

◆ MsiSourceListGetInfoW()

UINT WINAPI MsiSourceListGetInfoW ( LPCWSTR  szProduct,
LPCWSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
LPCWSTR  szProperty,
LPWSTR  szValue,
LPDWORD  pcchValue 
)

Definition at line 523 of file source.c.

527 {
528  WCHAR *source, *ptr, squashed_pc[SQUASHED_GUID_SIZE];
529  HKEY sourcekey, media;
530  DWORD size;
531  UINT rc;
532 
533  TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szProperty));
534 
535  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
537 
538  if (szValue && !pcchValue)
540 
541  if (dwContext != MSIINSTALLCONTEXT_USERMANAGED &&
542  dwContext != MSIINSTALLCONTEXT_USERUNMANAGED &&
543  dwContext != MSIINSTALLCONTEXT_MACHINE)
545 
546  if (!szProperty)
548 
549  if (szUserSid)
550  FIXME("Unhandled UserSid %s\n",debugstr_w(szUserSid));
551 
552  rc = OpenSourceKey(szProduct, &sourcekey, dwOptions, dwContext, FALSE);
553  if (rc != ERROR_SUCCESS)
554  return rc;
555 
556  if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ) ||
557  !wcscmp( szProperty, INSTALLPROPERTY_DISKPROMPTW ))
558  {
559  rc = OpenMediaSubkey(sourcekey, &media, FALSE);
560  if (rc != ERROR_SUCCESS)
561  {
562  RegCloseKey(sourcekey);
563  return ERROR_SUCCESS;
564  }
565 
566  if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ))
567  szProperty = L"MediaPackage";
568 
569  RegQueryValueExW(media, szProperty, 0, 0, (LPBYTE)szValue, pcchValue);
571  }
572  else if (!wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW ) ||
573  !wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDTYPEW ))
574  {
576  0, 0, NULL, &size);
577  if (rc != ERROR_SUCCESS)
578  {
579  static WCHAR szEmpty[] = L"";
580  rc = ERROR_SUCCESS;
581  source = NULL;
582  ptr = szEmpty;
583  goto output_out;
584  }
585 
586  source = msi_alloc(size);
588  0, 0, (LPBYTE)source, &size);
589 
590  if (!*source)
591  {
592  msi_free(source);
593  RegCloseKey(sourcekey);
594  return ERROR_SUCCESS;
595  }
596 
597  if (!wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDTYPEW ))
598  {
599  if (*source != 'n' && *source != 'u' && *source != 'm')
600  {
601  msi_free(source);
602  RegCloseKey(sourcekey);
603  return ERROR_SUCCESS;
604  }
605 
606  ptr = source;
607  source[1] = '\0';
608  }
609  else
610  {
611  ptr = wcsrchr(source, ';');
612  if (!ptr)
613  ptr = source;
614  else
615  ptr++;
616  }
617 output_out:
618  if (szValue)
619  {
620  if (lstrlenW(ptr) < *pcchValue)
621  lstrcpyW(szValue, ptr);
622  else
623  rc = ERROR_MORE_DATA;
624  }
625 
626  *pcchValue = lstrlenW(ptr);
627  msi_free(source);
628  }
629  else if (!wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW ))
630  {
631  *pcchValue = *pcchValue * sizeof(WCHAR);
632  rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, 0,
633  (LPBYTE)szValue, pcchValue);
634  if (rc != ERROR_SUCCESS && rc != ERROR_MORE_DATA)
635  {
636  *pcchValue = 0;
637  rc = ERROR_SUCCESS;
638  }
639  else
640  {
641  if (*pcchValue)
642  *pcchValue = (*pcchValue - 1) / sizeof(WCHAR);
643  if (szValue)
644  szValue[*pcchValue] = '\0';
645  }
646  }
647  else
648  {
649  FIXME("Unknown property %s\n",debugstr_w(szProperty));
651  }
652 
653  RegCloseKey(sourcekey);
654  return rc;
655 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
static const WCHAR INSTALLPROPERTY_PACKAGENAMEW[]
Definition: msi.h:265
#define ERROR_UNKNOWN_PROPERTY
Definition: winerror.h:966
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR INSTALLPROPERTY_MEDIAPACKAGEPATHW[]
Definition: msi.h:413
static void msi_free(void *mem)
Definition: msipriv.h:1159
#define lstrlenW
Definition: compat.h:750
static const WCHAR INSTALLPROPERTY_LASTUSEDSOURCEW[]
Definition: msi.h:405
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:53
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
static PVOID ptr
Definition: dispmode.c:27
static const WCHAR INSTALLPROPERTY_DISKPROMPTW[]
Definition: msi.h:417
static const WCHAR szEmpty[]
Definition: provider.c:50
__u8 media
Definition: mkdosfs.c:367
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR INSTALLPROPERTY_LASTUSEDTYPEW[]
Definition: msi.h:409
#define wcsrchr
Definition: compat.h:16
#define ERROR_MORE_DATA
Definition: dderror.h:13
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
#define lstrcpyW
Definition: compat.h:749
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:86
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1142
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by ACTION_ResolveSource(), find_published_source(), init_functionpointers(), MsiConfigureFeatureW(), MsiConfigureProductExW(), MsiReinstallFeatureW(), MsiSourceListGetInfoA(), and open_package().

◆ MsiSourceListSetInfoA()

UINT WINAPI MsiSourceListSetInfoA ( LPCSTR  szProduct,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
LPCSTR  szProperty,
LPCSTR  szValue 
)

Definition at line 660 of file source.c.

663 {
664  UINT ret;
665  LPWSTR product = NULL;
666  LPWSTR usersid = NULL;
667  LPWSTR property = NULL;
668  LPWSTR value = NULL;
669 
670  if (szProduct) product = strdupAtoW(szProduct);
671  if (szUserSid) usersid = strdupAtoW(szUserSid);
672  if (szProperty) property = strdupAtoW(szProperty);
673  if (szValue) value = strdupAtoW(szValue);
674 
675  ret = MsiSourceListSetInfoW(product, usersid, dwContext, dwOptions,
676  property, value);
677 
678  msi_free(product);
679  msi_free(usersid);
681  msi_free(value);
682 
683  return ret;
684 }
DWORD dwOptions
Definition: solitaire.cpp:24
Definition: pdh_main.c:93
static void msi_free(void *mem)
Definition: msipriv.h:1159
int ret
UINT WINAPI MsiSourceListSetInfoW(const WCHAR *szProduct, const WCHAR *szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, const WCHAR *szProperty, const WCHAR *szValue)
Definition: source.c:748
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65

Referenced by init_functionpointers().

◆ MsiSourceListSetInfoW()

UINT WINAPI MsiSourceListSetInfoW ( const WCHAR szProduct,
const WCHAR szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
const WCHAR szProperty,
const WCHAR szValue 
)

Definition at line 748 of file source.c.

750 {
751  WCHAR squashed_pc[SQUASHED_GUID_SIZE];
752  HKEY sourcekey, media;
754  UINT rc;
755 
756  TRACE( "%s, %s, %d, %#lx, %s, %s\n", debugstr_w(szProduct), debugstr_w(szUserSid), dwContext, dwOptions,
757  debugstr_w(szProperty), debugstr_w(szValue) );
758 
759  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
761 
762  if (!szProperty)
764 
765  if (!szValue)
766  return ERROR_UNKNOWN_PROPERTY;
767 
768  if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
770 
771  if (dwOptions & MSICODE_PATCH)
772  {
773  FIXME("Unhandled options MSICODE_PATCH\n");
774  return ERROR_UNKNOWN_PATCH;
775  }
776 
777  property = szProperty;
778  if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ))
779  property = L"MediaPackage";
780 
781  rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
782  if (rc != ERROR_SUCCESS)
783  return rc;
784 
785  if (wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW ) &&
787  {
788  RegCloseKey(sourcekey);
790  }
791 
792  if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ) ||
793  !wcscmp( szProperty, INSTALLPROPERTY_DISKPROMPTW ))
794  {
795  rc = OpenMediaSubkey(sourcekey, &media, TRUE);
796  if (rc == ERROR_SUCCESS)
797  {
798  rc = msi_reg_set_val_str(media, property, szValue);
800  }
801  }
802  else if (!wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW ))
803  {
804  DWORD size = (lstrlenW(szValue) + 1) * sizeof(WCHAR);
805  rc = RegSetValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0,
806  REG_SZ, (const BYTE *)szValue, size);
807  if (rc != ERROR_SUCCESS)
809  }
810  else if (!wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW ))
811  {
814  else
815  rc = msi_set_last_used_source(szProduct, szUserSid, dwContext,
816  dwOptions, szValue);
817  }
818  else
820 
821  RegCloseKey(sourcekey);
822  return rc;
823 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD dwOptions
Definition: solitaire.cpp:24
static const WCHAR INSTALLPROPERTY_PACKAGENAMEW[]
Definition: msi.h:265
#define ERROR_UNKNOWN_PROPERTY
Definition: winerror.h:966
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
static const WCHAR INSTALLPROPERTY_MEDIAPACKAGEPATHW[]
Definition: msi.h:413
#define lstrlenW
Definition: compat.h:750
static const WCHAR INSTALLPROPERTY_LASTUSEDSOURCEW[]
Definition: msi.h:405
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:53
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value)
Definition: source.c:686
static const WCHAR INSTALLPROPERTY_DISKPROMPTW[]
Definition: msi.h:417
LONG msi_reg_set_val_str(HKEY hkey, LPCWSTR name, LPCWSTR value) DECLSPEC_HIDDEN
Definition: registry.c:209
#define ERROR_UNKNOWN_PATCH
Definition: winerror.h:1005
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:4899
__u8 media
Definition: mkdosfs.c:367
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:734
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:86
unsigned int UINT
Definition: ndis.h:50
#define RegCloseKey(hKey)
Definition: registry.h:47
#define REG_SZ
Definition: layer.c:22

Referenced by msi_publish_sourcelist(), and MsiSourceListSetInfoA().

◆ OpenMediaSubkey()

static UINT OpenMediaSubkey ( HKEY  rootkey,
HKEY key,
BOOL  create 
)
static

Definition at line 105 of file source.c.

106 {
107  UINT rc;
108 
109  if (create)
110  rc = RegCreateKeyW(rootkey, L"Media", key);
111  else
112  rc = RegOpenKeyW(rootkey, L"Media", key);
113 
114  return rc;
115 }
#define L(x)
Definition: ntvdm.h:50
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
unsigned int UINT
Definition: ndis.h:50
static const struct access_res create[16]
Definition: package.c:7644
Definition: copy.c:22

Referenced by MsiSourceListAddMediaDiskW(), MsiSourceListAddSourceExW(), MsiSourceListEnumMediaDisksW(), MsiSourceListGetInfoW(), and MsiSourceListSetInfoW().

◆ OpenNetworkSubkey()

static UINT OpenNetworkSubkey ( HKEY  rootkey,
HKEY key,
BOOL  create 
)
static

Definition at line 117 of file source.c.

118 {
119  UINT rc;
120 
121  if (create)
122  rc = RegCreateKeyW(rootkey, L"Net", key);
123  else
124  rc = RegOpenKeyW(rootkey, L"Net", key);
125 
126  return rc;
127 }
#define L(x)
Definition: ntvdm.h:50
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
unsigned int UINT
Definition: ndis.h:50
static const struct access_res create[16]
Definition: package.c:7644
Definition: copy.c:22

Referenced by MsiSourceListAddSourceExW(), and MsiSourceListEnumSourcesW().

◆ OpenSourceKey()

static UINT OpenSourceKey ( LPCWSTR  szProduct,
HKEY key,
DWORD  dwOptions,
MSIINSTALLCONTEXT  context,
BOOL  create 
)
static

Definition at line 53 of file source.c.

55 {
56  HKEY rootkey = 0;
58 
60  {
62  rc = MSIREG_OpenUserPatchesKey(szProduct, &rootkey, create);
63  else
64  rc = MSIREG_OpenProductKey(szProduct, NULL, context,
65  &rootkey, create);
66  }
68  {
70  rc = MSIREG_OpenUserPatchesKey(szProduct, &rootkey, create);
71  else
72  rc = MSIREG_OpenProductKey(szProduct, NULL, context,
73  &rootkey, create);
74  }
76  {
78  rc = MSIREG_OpenPatchesKey(szProduct, &rootkey, create);
79  else
80  rc = MSIREG_OpenProductKey(szProduct, NULL, context,
81  &rootkey, create);
82  }
83 
84  if (rc != ERROR_SUCCESS)
85  {
87  return ERROR_UNKNOWN_PATCH;
88  else
89  return ERROR_UNKNOWN_PRODUCT;
90  }
91 
92  if (create)
93  rc = RegCreateKeyW(rootkey, L"SourceList", key);
94  else
95  {
96  rc = RegOpenKeyW(rootkey, L"SourceList", key);
97  if (rc != ERROR_SUCCESS)
99  }
100  RegCloseKey(rootkey);
101 
102  return rc;
103 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: http.c:7251
#define L(x)
Definition: ntvdm.h:50
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:768
#define ERROR_UNKNOWN_PATCH
Definition: winerror.h:1005
UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:338
#define ERROR_BAD_CONFIGURATION
Definition: winerror.h:968
#define ERROR_UNKNOWN_PRODUCT
Definition: winerror.h:963
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:390
static const struct access_res create[16]
Definition: package.c:7644
#define RegCloseKey(hKey)
Definition: registry.h:47
Definition: copy.c:22

Referenced by msi_set_last_used_source(), MsiSourceListAddMediaDiskW(), MsiSourceListAddSourceExW(), MsiSourceListEnumMediaDisksW(), MsiSourceListEnumSourcesW(), MsiSourceListGetInfoW(), and MsiSourceListSetInfoW().

◆ OpenURLSubkey()

static UINT OpenURLSubkey ( HKEY  rootkey,
HKEY key,
BOOL  create 
)
static

Definition at line 129 of file source.c.

130 {
131  UINT rc;
132 
133  if (create)
134  rc = RegCreateKeyW(rootkey, L"URL", key);
135  else
136  rc = RegOpenKeyW(rootkey, L"URL", key);
137 
138  return rc;
139 }
#define L(x)
Definition: ntvdm.h:50
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
unsigned int UINT
Definition: ndis.h:50
static const struct access_res create[16]
Definition: package.c:7644
Definition: copy.c:22

Referenced by MsiSourceListAddSourceExW(), and MsiSourceListEnumSourcesW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msi  )