ReactOS  0.4.13-dev-922-g2fbff73
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 "wine/unicode.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 (LPCSTR szProductCodeOrPatchCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPDWORD pdwDiskId, LPSTR szVolumeLabel, LPDWORD pcchVolumeLabel, LPSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
 
UINT WINAPI MsiSourceListEnumMediaDisksW (LPCWSTR szProductCodeOrPatchCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPDWORD pdwDiskId, LPWSTR szVolumeLabel, LPDWORD pcchVolumeLabel, LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
 
UINT WINAPI MsiSourceListEnumSourcesA (LPCSTR szProductCodeOrPatch, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPSTR szSource, LPDWORD pcchSource)
 
UINT WINAPI MsiSourceListEnumSourcesW (LPCWSTR szProductCodeOrPatch, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPWSTR szSource, LPDWORD 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 (LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szProperty, LPCWSTR 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 (LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, DWORD dwIndex)
 
UINT WINAPI MsiSourceListAddMediaDiskA (LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, LPCSTR szVolumeLabel, LPCSTR szDiskPrompt)
 
UINT WINAPI MsiSourceListAddMediaDiskW (LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, LPCWSTR szVolumeLabel, LPCWSTR szDiskPrompt)
 
UINT WINAPI MsiSourceListClearAllA (LPCSTR szProduct, LPCSTR szUserName, DWORD dwReserved)
 
UINT WINAPI MsiSourceListClearAllW (LPCWSTR szProduct, LPCWSTR szUserName, DWORD dwReserved)
 
UINT WINAPI MsiSourceListClearAllExA (LPCSTR szProduct, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions)
 
UINT WINAPI MsiSourceListClearAllExW (LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions)
 
UINT WINAPI MsiSourceListClearSourceA (LPCSTR szProductCodeOrPatchCode, LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCSTR szSource)
 
UINT WINAPI MsiSourceListClearSourceW (LPCWSTR szProductCodeOrPatchCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource)
 

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 967 of file source.c.

969 {
970  media_info *iter;
971  BOOL found = FALSE;
972  static const WCHAR fmt[] = {'%','i',0};
973 
974  if (index) *index = 0;
975 
976  if (list_empty(sourcelist))
977  {
978  list_add_head(sourcelist, &info->entry);
979  return;
980  }
981 
982  LIST_FOR_EACH_ENTRY(iter, sourcelist, media_info, entry)
983  {
984  if (!found && info->index < iter->index)
985  {
986  found = TRUE;
987  list_add_before(&iter->entry, &info->entry);
988  }
989 
990  /* update the rest of the list */
991  if (found)
992  sprintfW(iter->szIndex, fmt, ++iter->index);
993  else if (index)
994  (*index)++;
995  }
996 
997  if (!found)
998  list_add_after(&iter->entry, &info->entry);
999 }
#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
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD index
Definition: source.c:51
uint32_t entry
Definition: isohybrid.c:63
WCHAR szIndex[10]
Definition: source.c:50
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
#define sprintfW
Definition: unicode.h:58
struct list entry
Definition: source.c:48
__WINE_SERVER_LIST_INLINE void list_add_before(struct list *elem, struct list *to_add)
Definition: list.h:87
Definition: dsound.c:943
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 1001 of file source.c.

1002 {
1003  UINT r = ERROR_SUCCESS;
1004  DWORD index = 0;
1005  WCHAR name[10];
1006  DWORD size, val_size;
1007  media_info *entry;
1008 
1009  *count = 0;
1010 
1011  while (r == ERROR_SUCCESS)
1012  {
1013  size = sizeof(name) / sizeof(name[0]);
1014  r = RegEnumValueW(sourcekey, index, name, &size, NULL, NULL, NULL, &val_size);
1015  if (r != ERROR_SUCCESS)
1016  return r;
1017 
1018  entry = msi_alloc(sizeof(media_info));
1019  if (!entry)
1020  goto error;
1021 
1022  entry->path = msi_alloc(val_size);
1023  if (!entry->path)
1024  {
1025  msi_free(entry);
1026  goto error;
1027  }
1028 
1029  lstrcpyW(entry->szIndex, name);
1030  entry->index = atoiW(name);
1031 
1032  size++;
1033  r = RegEnumValueW(sourcekey, index, name, &size, NULL,
1034  NULL, (LPBYTE)entry->path, &val_size);
1035  if (r != ERROR_SUCCESS)
1036  {
1037  msi_free(entry->path);
1038  msi_free(entry);
1039  goto error;
1040  }
1041 
1042  index = ++(*count);
1043  add_source_to_list(sourcelist, entry, NULL);
1044  }
1045 
1046 error:
1047  *count = -1;
1048  free_source_list(sourcelist);
1049  return ERROR_OUTOFMEMORY;
1050 }
#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:967
unsigned char * LPBYTE
Definition: typedefs.h:52
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
smooth NULL
Definition: ftsmooth.c:416
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:956
#define lstrcpyW
Definition: compat.h:406
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:36
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by MsiSourceListAddSourceExW().

◆ free_source_list()

static void free_source_list ( struct list sourcelist)
static

Definition at line 956 of file source.c.

957 {
958  while (!list_empty(sourcelist))
959  {
961  list_remove(&info->entry);
962  msi_free(info->path);
963  msi_free(info);
964  }
965 }
__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
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
#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 702 of file source.c.

705 {
706  HKEY source;
707  LPWSTR buffer;
708  WCHAR typechar;
709  DWORD size;
710  UINT r;
711  int index = 1;
712 
713  static const WCHAR format[] = {'%','c',';','%','i',';','%','s',0};
714 
716  typechar = 'n';
717  else if (options & MSISOURCETYPE_URL)
718  typechar = 'u';
719  else if (options & MSISOURCETYPE_MEDIA)
720  typechar = 'm';
721  else
723 
724  if (!(options & MSISOURCETYPE_MEDIA))
725  {
726  r = MsiSourceListAddSourceExW(product, usersid, context,
727  options, value, 0);
728  if (r != ERROR_SUCCESS)
729  return r;
730 
731  index = 0;
732  while ((r = MsiSourceListEnumSourcesW(product, usersid, context, options,
733  index, NULL, NULL)) == ERROR_SUCCESS)
734  index++;
735 
736  if (r != ERROR_NO_MORE_ITEMS)
737  return r;
738  }
739 
740  size = (lstrlenW(format) + lstrlenW(value) + 7) * sizeof(WCHAR);
741  buffer = msi_alloc(size);
742  if (!buffer)
743  return ERROR_OUTOFMEMORY;
744 
746  if (r != ERROR_SUCCESS)
747  {
748  msi_free(buffer);
749  return r;
750  }
751 
752  sprintfW(buffer, format, typechar, index, value);
753 
754  size = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
756  REG_SZ, (LPBYTE)buffer, size);
757  msi_free(buffer);
758 
760  return r;
761 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
Definition: http.c:6587
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
#define lstrlenW
Definition: compat.h:407
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static const WCHAR INSTALLPROPERTY_LASTUSEDSOURCEW[]
Definition: msi.h:405
UINT WINAPI MsiSourceListAddSourceExW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, DWORD dwIndex)
Definition: source.c:1055
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:54
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPWSTR szSource, LPDWORD pcchSource)
Definition: source.c:411
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:4895
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define sprintfW
Definition: unicode.h:58
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#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 1180 of file source.c.

1183 {
1184  UINT r;
1185  LPWSTR product = NULL;
1186  LPWSTR usersid = NULL;
1187  LPWSTR volume = NULL;
1188  LPWSTR prompt = NULL;
1189 
1190  if (szProduct) product = strdupAtoW(szProduct);
1191  if (szUserSid) usersid = strdupAtoW(szUserSid);
1192  if (szVolumeLabel) volume = strdupAtoW(szVolumeLabel);
1193  if (szDiskPrompt) prompt = strdupAtoW(szDiskPrompt);
1194 
1195  r = MsiSourceListAddMediaDiskW(product, usersid, dwContext, dwOptions,
1196  dwDiskId, volume, prompt);
1197 
1198  msi_free(product);
1199  msi_free(usersid);
1200  msi_free(volume);
1201  msi_free(prompt);
1202 
1203  return r;
1204 }
DWORD dwOptions
Definition: solitaire.cpp:23
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
smooth NULL
Definition: ftsmooth.c:416
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, LPCWSTR szVolumeLabel, LPCWSTR szDiskPrompt)
Definition: source.c:1209
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:67

Referenced by init_functionpointers().

◆ MsiSourceListAddMediaDiskW()

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

Definition at line 1209 of file source.c.

1212 {
1213  static const WCHAR fmt[] = {'%','i',0};
1214  HKEY sourcekey, mediakey;
1215  UINT rc;
1216  WCHAR *buffer, squashed_pc[SQUASHED_GUID_SIZE], szIndex[10];
1217  DWORD size;
1218 
1219  TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct),
1220  debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId,
1221  debugstr_w(szVolumeLabel), debugstr_w(szDiskPrompt));
1222 
1223  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
1224  return ERROR_INVALID_PARAMETER;
1225 
1227  return ERROR_INVALID_PARAMETER;
1228 
1229  if ((szVolumeLabel && !*szVolumeLabel) || (szDiskPrompt && !*szDiskPrompt))
1230  return ERROR_INVALID_PARAMETER;
1231 
1232  if ((dwContext & MSIINSTALLCONTEXT_MACHINE) && szUserSid)
1233  return ERROR_INVALID_PARAMETER;
1234 
1235  if (dwOptions & MSICODE_PATCH)
1236  {
1237  FIXME("Unhandled options MSICODE_PATCH\n");
1238  return ERROR_FUNCTION_FAILED;
1239  }
1240 
1241  rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
1242  if (rc != ERROR_SUCCESS)
1243  return rc;
1244 
1245  OpenMediaSubkey(sourcekey, &mediakey, TRUE);
1246 
1247  sprintfW(szIndex, fmt, dwDiskId);
1248 
1249  size = 2;
1250  if (szVolumeLabel) size += lstrlenW(szVolumeLabel);
1251  if (szDiskPrompt) size += lstrlenW(szDiskPrompt);
1252 
1253  size *= sizeof(WCHAR);
1254  buffer = msi_alloc(size);
1255  *buffer = '\0';
1256 
1257  if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel);
1259  if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt);
1260 
1261  RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size);
1262  msi_free(buffer);
1263 
1264  RegCloseKey(sourcekey);
1265  RegCloseKey(mediakey);
1266 
1267  return ERROR_SUCCESS;
1268 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static const WCHAR szSemiColon[]
Definition: msipriv.h:1115
DWORD dwOptions
Definition: solitaire.cpp:23
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint buffer
Definition: glext.h:5915
#define lstrlenW
Definition: compat.h:407
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:54
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
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:4895
#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:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:711
#define lstrcpyW
Definition: compat.h:406
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:87
#define sprintfW
Definition: unicode.h:58
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
Definition: dsound.c:943
#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 912 of file source.c.

914 {
915  INT ret;
916  LPWSTR szwproduct;
917  LPWSTR szwusername;
918  LPWSTR szwsource;
919 
920  szwproduct = strdupAtoW( szProduct );
921  szwusername = strdupAtoW( szUserName );
922  szwsource = strdupAtoW( szSource );
923 
924  ret = MsiSourceListAddSourceW(szwproduct, szwusername, dwReserved, szwsource);
925 
926  msi_free(szwproduct);
927  msi_free(szwusername);
928  msi_free(szwsource);
929 
930  return ret;
931 }
int32_t INT
Definition: typedefs.h:56
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
int ret
static const WCHAR szSource[]
Definition: automation.c:501
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT WINAPI MsiSourceListAddSourceW(LPCWSTR szProduct, LPCWSTR szUserName, DWORD dwReserved, LPCWSTR szSource)
Definition: source.c:848
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:67

Referenced by init_functionpointers().

◆ MsiSourceListAddSourceExA()

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

Definition at line 936 of file source.c.

938 {
939  UINT ret;
940  LPWSTR product, usersid, source;
941 
942  product = strdupAtoW(szProduct);
943  usersid = strdupAtoW(szUserSid);
945 
946  ret = MsiSourceListAddSourceExW(product, usersid, dwContext,
947  dwOptions, source, dwIndex);
948 
949  msi_free(product);
950  msi_free(usersid);
951  msi_free(source);
952 
953  return ret;
954 }
DWORD dwOptions
Definition: solitaire.cpp:23
UINT WINAPI MsiSourceListAddSourceExW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, DWORD dwIndex)
Definition: source.c:1055
int ret
static const WCHAR szSource[]
Definition: automation.c:501
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:67

Referenced by init_functionpointers().

◆ MsiSourceListAddSourceExW()

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

Definition at line 1055 of file source.c.

1058 {
1059  static const WCHAR fmt[] = {'%','i',0};
1060  HKEY sourcekey, typekey;
1061  UINT rc;
1062  struct list sourcelist;
1063  media_info *info;
1064  WCHAR *source, squashed_pc[SQUASHED_GUID_SIZE], name[10];
1065  LPCWSTR postfix;
1066  DWORD size, count, index;
1067 
1068  TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
1069  dwContext, dwOptions, debugstr_w(szSource), dwIndex);
1070 
1071  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
1072  return ERROR_INVALID_PARAMETER;
1073 
1074  if (!szSource || !*szSource)
1075  return ERROR_INVALID_PARAMETER;
1076 
1078  return ERROR_INVALID_PARAMETER;
1079 
1080  if (dwOptions & MSICODE_PATCH)
1081  {
1082  FIXME("Unhandled options MSICODE_PATCH\n");
1083  return ERROR_FUNCTION_FAILED;
1084  }
1085 
1086  if (szUserSid && (dwContext & MSIINSTALLCONTEXT_MACHINE))
1087  return ERROR_INVALID_PARAMETER;
1088 
1089  rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
1090  if (rc != ERROR_SUCCESS)
1091  return rc;
1092 
1094  rc = OpenNetworkSubkey(sourcekey, &typekey, TRUE);
1095  else if (dwOptions & MSISOURCETYPE_URL)
1096  rc = OpenURLSubkey(sourcekey, &typekey, TRUE);
1097  else if (dwOptions & MSISOURCETYPE_MEDIA)
1098  rc = OpenMediaSubkey(sourcekey, &typekey, TRUE);
1099  else
1100  {
1101  ERR("unknown media type: %08x\n", dwOptions);
1102  RegCloseKey(sourcekey);
1103  return ERROR_FUNCTION_FAILED;
1104  }
1105  if (rc != ERROR_SUCCESS)
1106  {
1107  ERR("can't open subkey %u\n", rc);
1108  RegCloseKey(sourcekey);
1109  return rc;
1110  }
1111 
1113  if (szSource[lstrlenW(szSource) - 1] == *postfix)
1114  source = strdupW(szSource);
1115  else
1116  {
1117  size = lstrlenW(szSource) + 2;
1118  source = msi_alloc(size * sizeof(WCHAR));
1120  lstrcatW(source, postfix);
1121  }
1122 
1123  list_init(&sourcelist);
1124  rc = fill_source_list(&sourcelist, typekey, &count);
1125  if (rc != ERROR_NO_MORE_ITEMS)
1126  goto done;
1127 
1128  size = (lstrlenW(source) + 1) * sizeof(WCHAR);
1129 
1130  if (count == 0)
1131  {
1132  rc = RegSetValueExW(typekey, szOne, 0, REG_EXPAND_SZ, (LPBYTE)source, size);
1133  goto done;
1134  }
1135  else if (dwIndex > count || dwIndex == 0)
1136  {
1137  sprintfW(name, fmt, count + 1);
1138  rc = RegSetValueExW(typekey, name, 0, REG_EXPAND_SZ, (LPBYTE)source, size);
1139  goto done;
1140  }
1141  else
1142  {
1143  sprintfW(name, fmt, dwIndex);
1144  info = msi_alloc(sizeof(media_info));
1145  if (!info)
1146  {
1147  rc = ERROR_OUTOFMEMORY;
1148  goto done;
1149  }
1150 
1151  info->path = strdupW(source);
1152  lstrcpyW(info->szIndex, name);
1153  info->index = dwIndex;
1154  add_source_to_list(&sourcelist, info, &index);
1155 
1156  LIST_FOR_EACH_ENTRY(info, &sourcelist, media_info, entry)
1157  {
1158  if (info->index < index)
1159  continue;
1160 
1161  size = (lstrlenW(info->path) + 1) * sizeof(WCHAR);
1162  rc = RegSetValueExW(typekey, info->szIndex, 0,
1163  REG_EXPAND_SZ, (LPBYTE)info->path, size);
1164  if (rc != ERROR_SUCCESS)
1165  goto done;
1166  }
1167  }
1168 
1169 done:
1170  free_source_list(&sourcelist);
1171  msi_free(source);
1172  RegCloseKey(typekey);
1173  RegCloseKey(sourcekey);
1174  return rc;
1175 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
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:967
#define lstrlenW
Definition: compat.h:407
struct _test_info info[]
Definition: SetCursorPos.c:19
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:54
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
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:4895
static const WCHAR szForwardSlash[]
Definition: msipriv.h:1112
#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:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *count)
Definition: source.c:1001
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
static const WCHAR szSource[]
Definition: automation.c:501
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
static void free_source_list(struct list *sourcelist)
Definition: source.c:956
static UINT OpenNetworkSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:119
#define ERR(fmt,...)
Definition: debug.h:109
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:711
#define lstrcpyW
Definition: compat.h:406
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:87
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define sprintfW
Definition: unicode.h:58
static const WCHAR szOne[]
Definition: msipriv.h:1108
unsigned int UINT
Definition: ndis.h:50
static const WCHAR szBackSlash[]
Definition: msipriv.h:1111
static UINT OpenURLSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:132
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:36
__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:1204
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
Definition: dsound.c:943
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 848 of file source.c.

850 {
851  WCHAR *sidstr = NULL, squashed_pc[SQUASHED_GUID_SIZE];
852  INT ret;
853  DWORD sidsize = 0, domsize = 0, context;
854  HKEY hkey = 0;
855  UINT r;
856 
857  TRACE("%s %s %s\n", debugstr_w(szProduct), debugstr_w(szUserName), debugstr_w(szSource));
858 
859  if (!szSource || !*szSource)
861 
862  if (dwReserved != 0)
864 
865  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
867 
868  if (!szUserName || !*szUserName)
870  else
871  {
872  if (LookupAccountNameW(NULL, szUserName, NULL, &sidsize, NULL, &domsize, NULL))
873  {
874  PSID psid = msi_alloc(sidsize);
875 
876  if (LookupAccountNameW(NULL, szUserName, psid, &sidsize, NULL, &domsize, NULL))
877  ConvertSidToStringSidW(psid, &sidstr);
878 
879  msi_free(psid);
880  }
881 
882  r = MSIREG_OpenProductKey(szProduct, NULL,
884  if (r == ERROR_SUCCESS)
886  else
887  {
888  r = MSIREG_OpenProductKey(szProduct, NULL,
890  &hkey, FALSE);
891  if (r != ERROR_SUCCESS)
892  return ERROR_UNKNOWN_PRODUCT;
893 
895  }
896 
897  RegCloseKey(hkey);
898  }
899 
900  ret = MsiSourceListAddSourceExW(szProduct, sidstr,
902 
903  if (sidstr)
904  LocalFree(sidstr);
905 
906  return ret;
907 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: http.c:6587
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3259
int32_t INT
Definition: typedefs.h:56
UINT WINAPI MsiSourceListAddSourceExW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, DWORD dwIndex)
Definition: source.c:1055
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
_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
smooth NULL
Definition: ftsmooth.c:416
UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:492
#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
int ret
static const WCHAR szSource[]
Definition: automation.c:501
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:711
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:87
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
BOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse)
Definition: misc.c:626

Referenced by MsiSourceListAddSourceA().

◆ MsiSourceListClearAllA()

UINT WINAPI MsiSourceListClearAllA ( LPCSTR  szProduct,
LPCSTR  szUserName,
DWORD  dwReserved 
)

Definition at line 1273 of file source.c.

1274 {
1275  FIXME("(%s %s %d)\n", debugstr_a(szProduct), debugstr_a(szUserName), dwReserved);
1276  return ERROR_SUCCESS;
1277 }
#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:110
#define debugstr_a
Definition: kernel32.h:31

◆ MsiSourceListClearAllExA()

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

Definition at line 1291 of file source.c.

1293 {
1294  FIXME("(%s %s %d %08x)\n", debugstr_a(szProduct), debugstr_a(szUserSid),
1295  dwContext, dwOptions);
1296  return ERROR_SUCCESS;
1297 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31

◆ MsiSourceListClearAllExW()

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

Definition at line 1302 of file source.c.

1304 {
1305  FIXME("(%s %s %d %08x)\n", debugstr_w(szProduct), debugstr_w(szUserSid),
1306  dwContext, dwOptions);
1307  return ERROR_SUCCESS;
1308 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ MsiSourceListClearAllW()

UINT WINAPI MsiSourceListClearAllW ( LPCWSTR  szProduct,
LPCWSTR  szUserName,
DWORD  dwReserved 
)

Definition at line 1282 of file source.c.

1283 {
1284  FIXME("(%s %s %d)\n", debugstr_w(szProduct), debugstr_w(szUserName), dwReserved);
1285  return ERROR_SUCCESS;
1286 }
#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:110

◆ MsiSourceListClearSourceA()

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

Definition at line 1313 of file source.c.

1316 {
1317  FIXME("(%s %s %x %x %s)\n", debugstr_a(szProductCodeOrPatchCode), debugstr_a(szUserSid),
1318  dwContext, dwOptions, debugstr_a(szSource));
1319  return ERROR_SUCCESS;
1320 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
static const WCHAR szSource[]
Definition: automation.c:501

◆ MsiSourceListClearSourceW()

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

Definition at line 1325 of file source.c.

1328 {
1329  FIXME("(%s %s %x %x %s)\n", debugstr_w(szProductCodeOrPatchCode), debugstr_w(szUserSid),
1330  dwContext, dwOptions, debugstr_w(szSource));
1331  return ERROR_SUCCESS;
1332 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static const WCHAR szSource[]
Definition: automation.c:501

◆ MsiSourceListEnumMediaDisksA()

UINT WINAPI MsiSourceListEnumMediaDisksA ( LPCSTR  szProductCodeOrPatchCode,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
LPDWORD  pdwDiskId,
LPSTR  szVolumeLabel,
LPDWORD  pcchVolumeLabel,
LPSTR  szDiskPrompt,
LPDWORD  pcchDiskPrompt 
)

Definition at line 148 of file source.c.

153 {
154  LPWSTR product = NULL;
155  LPWSTR usersid = NULL;
156  LPWSTR volume = NULL;
157  LPWSTR prompt = NULL;
159 
160  TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p, %p)\n", debugstr_a(szProductCodeOrPatchCode),
161  debugstr_a(szUserSid), dwContext, dwOptions, dwIndex, pdwDiskId,
162  szVolumeLabel, pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt);
163 
164  if (szDiskPrompt && !pcchDiskPrompt)
166 
167  if (szProductCodeOrPatchCode) product = strdupAtoW(szProductCodeOrPatchCode);
168  if (szUserSid) usersid = strdupAtoW(szUserSid);
169 
170  /* FIXME: add tests for an invalid format */
171 
172  if (pcchVolumeLabel)
173  volume = msi_alloc(*pcchVolumeLabel * sizeof(WCHAR));
174 
175  if (pcchDiskPrompt)
176  prompt = msi_alloc(*pcchDiskPrompt * sizeof(WCHAR));
177 
178  if (volume) *volume = '\0';
179  if (prompt) *prompt = '\0';
180  r = MsiSourceListEnumMediaDisksW(product, usersid, dwContext, dwOptions,
181  dwIndex, pdwDiskId, volume, pcchVolumeLabel,
182  prompt, pcchDiskPrompt);
183  if (r != ERROR_SUCCESS)
184  goto done;
185 
186  if (szVolumeLabel && pcchVolumeLabel)
187  WideCharToMultiByte(CP_ACP, 0, volume, -1, szVolumeLabel,
188  *pcchVolumeLabel + 1, NULL, NULL);
189 
190  if (szDiskPrompt)
191  WideCharToMultiByte(CP_ACP, 0, prompt, -1, szDiskPrompt,
192  *pcchDiskPrompt + 1, NULL, NULL);
193 
194 done:
195  msi_free(product);
196  msi_free(usersid);
197  msi_free(volume);
198  msi_free(prompt);
199 
200  return r;
201 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPDWORD pdwDiskId, LPWSTR szVolumeLabel, LPDWORD pcchVolumeLabel, LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
Definition: source.c:206
smooth NULL
Definition: ftsmooth.c:416
#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
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:67

Referenced by init_functionpointers().

◆ MsiSourceListEnumMediaDisksW()

UINT WINAPI MsiSourceListEnumMediaDisksW ( LPCWSTR  szProductCodeOrPatchCode,
LPCWSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
LPDWORD  pdwDiskId,
LPWSTR  szVolumeLabel,
LPDWORD  pcchVolumeLabel,
LPWSTR  szDiskPrompt,
LPDWORD  pcchDiskPrompt 
)

Definition at line 206 of file source.c.

211 {
212  static const WCHAR fmt[] = {'#','%','d',0};
213  WCHAR squashed_pc[SQUASHED_GUID_SIZE], convert[11];
214  WCHAR *value = NULL, *data = NULL, *ptr, *ptr2;
215  HKEY source, media;
216  DWORD valuesz, datasz = 0, type, numvals, size;
217  LONG res;
218  UINT r;
219  static DWORD index = 0;
220 
221  TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p)\n", debugstr_w(szProductCodeOrPatchCode),
222  debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel,
223  pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt);
224 
225  if (!szProductCodeOrPatchCode || !squash_guid( szProductCodeOrPatchCode, squashed_pc ))
227 
228  if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
230 
233 
234  if (szDiskPrompt && !pcchDiskPrompt)
236 
237  if (dwIndex == 0)
238  index = 0;
239 
240  if (dwIndex != index)
242 
243  r = OpenSourceKey(szProductCodeOrPatchCode, &source, dwOptions, dwContext, FALSE);
244  if (r != ERROR_SUCCESS)
245  return r;
246 
248  if (r != ERROR_SUCCESS)
249  {
251  return ERROR_NO_MORE_ITEMS;
252  }
253 
255  NULL, &numvals, &valuesz, &datasz, NULL, NULL);
256  if (res != ERROR_SUCCESS)
257  {
259  goto done;
260  }
261 
262  value = msi_alloc(++valuesz * sizeof(WCHAR));
263  data = msi_alloc(++datasz * sizeof(WCHAR));
264  if (!value || !data)
265  {
267  goto done;
268  }
269 
270  r = RegEnumValueW(media, dwIndex, value, &valuesz,
271  NULL, &type, (LPBYTE)data, &datasz);
272  if (r != ERROR_SUCCESS)
273  goto done;
274 
275  if (pdwDiskId)
276  *pdwDiskId = atolW(value);
277 
278  ptr2 = data;
279  ptr = strchrW(data, ';');
280  if (!ptr)
281  ptr = data;
282  else
283  *ptr = '\0';
284 
285  if (pcchVolumeLabel)
286  {
287  if (type == REG_DWORD)
288  {
289  sprintfW(convert, fmt, *data);
290  size = lstrlenW(convert);
291  ptr2 = convert;
292  }
293  else
294  size = lstrlenW(data);
295 
296  if (size >= *pcchVolumeLabel)
297  r = ERROR_MORE_DATA;
298  else if (szVolumeLabel)
299  lstrcpyW(szVolumeLabel, ptr2);
300 
301  *pcchVolumeLabel = size;
302  }
303 
304  if (pcchDiskPrompt)
305  {
306  if (!*ptr)
307  ptr++;
308 
309  if (type == REG_DWORD)
310  {
311  sprintfW(convert, fmt, *ptr);
312  size = lstrlenW(convert);
313  ptr = convert;
314  }
315  else
316  size = lstrlenW(ptr);
317 
318  if (size >= *pcchDiskPrompt)
319  r = ERROR_MORE_DATA;
320  else if (szDiskPrompt)
321  lstrcpyW(szDiskPrompt, ptr);
322 
323  *pcchDiskPrompt = size;
324  }
325 
326  index++;
327 
328 done:
329  msi_free(value);
330  msi_free(data);
332 
333  return r;
334 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:407
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:54
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
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
smooth NULL
Definition: ftsmooth.c:416
WINE_UNICODE_INLINE long int atolW(const WCHAR *str)
Definition: unicode.h:310
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
#define ERROR_BAD_CONFIGURATION
Definition: winerror.h:968
int convert
Definition: msacm.c:1362
static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:106
__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:3686
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:711
#define lstrcpyW
Definition: compat.h:406
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:87
#define sprintfW
Definition: unicode.h:58
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
GLuint res
Definition: glext.h:9613
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
#define REG_DWORD
Definition: sdbapi.c:596
Definition: dsound.c:943
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by find_published_source(), and MsiSourceListEnumMediaDisksA().

◆ MsiSourceListEnumSourcesA()

UINT WINAPI MsiSourceListEnumSourcesA ( LPCSTR  szProductCodeOrPatch,
LPCSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
LPSTR  szSource,
LPDWORD  pcchSource 
)

Definition at line 339 of file source.c.

343 {
344  LPWSTR product = NULL;
345  LPWSTR usersid = NULL;
346  LPWSTR source = NULL;
347  DWORD len = 0;
349  static DWORD index = 0;
350 
351  TRACE("(%s, %s, %d, %d, %d, %p, %p)\n", debugstr_a(szProductCodeOrPatch),
352  debugstr_a(szUserSid), dwContext, dwOptions, dwIndex, szSource, pcchSource);
353 
354  if (dwIndex == 0)
355  index = 0;
356 
357  if (szSource && !pcchSource)
358  goto done;
359 
360  if (dwIndex != index)
361  goto done;
362 
363  if (szProductCodeOrPatch) product = strdupAtoW(szProductCodeOrPatch);
364  if (szUserSid) usersid = strdupAtoW(szUserSid);
365 
366  r = MsiSourceListEnumSourcesW(product, usersid, dwContext, dwOptions,
367  dwIndex, NULL, &len);
368  if (r != ERROR_SUCCESS)
369  goto done;
370 
371  source = msi_alloc(++len * sizeof(WCHAR));
372  if (!source)
373  {
375  goto done;
376  }
377 
378  *source = '\0';
379  r = MsiSourceListEnumSourcesW(product, usersid, dwContext, dwOptions,
380  dwIndex, source, &len);
381  if (r != ERROR_SUCCESS)
382  goto done;
383 
384  len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
385  if (pcchSource && *pcchSource >= len)
387  else if (szSource)
388  r = ERROR_MORE_DATA;
389 
390  if (pcchSource)
391  *pcchSource = len - 1;
392 
393 done:
394  msi_free(product);
395  msi_free(usersid);
396  msi_free(source);
397 
398  if (r == ERROR_SUCCESS)
399  {
400  if (szSource || !pcchSource) index++;
401  }
402  else if (dwIndex > index)
403  index = 0;
404 
405  return r;
406 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwIndex, LPWSTR szSource, LPDWORD pcchSource)
Definition: source.c:411
#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
static const WCHAR szSource[]
Definition: automation.c:501
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:67
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by init_functionpointers().

◆ MsiSourceListEnumSourcesW()

UINT WINAPI MsiSourceListEnumSourcesW ( LPCWSTR  szProductCodeOrPatch,
LPCWSTR  szUserSid,
MSIINSTALLCONTEXT  dwContext,
DWORD  dwOptions,
DWORD  dwIndex,
LPWSTR  szSource,
LPDWORD  pcchSource 
)

Definition at line 411 of file source.c.

415 {
416  static const WCHAR format[] = {'%','d',0};
417  WCHAR squashed_pc[SQUASHED_GUID_SIZE], name[32];
418  HKEY source = NULL, subkey = NULL;
419  LONG res;
421  static DWORD index = 0;
422 
423  TRACE("(%s, %s, %d, %d, %d, %p, %p)\n", debugstr_w(szProductCodeOrPatch),
424  debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szSource, pcchSource);
425 
426  if (dwIndex == 0)
427  index = 0;
428 
429  if (!szProductCodeOrPatch || !squash_guid( szProductCodeOrPatch, squashed_pc ))
430  goto done;
431 
432  if (szSource && !pcchSource)
433  goto done;
434 
436  goto done;
437 
439  goto done;
440 
441  if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
442  goto done;
443 
444  if (dwIndex != index)
445  goto done;
446 
447  r = OpenSourceKey( szProductCodeOrPatch, &source, dwOptions, dwContext, FALSE );
448  if (r != ERROR_SUCCESS)
449  goto done;
450 
452  r = OpenNetworkSubkey(source, &subkey, FALSE);
453  else if (dwOptions & MSISOURCETYPE_URL)
454  r = OpenURLSubkey(source, &subkey, FALSE);
455 
456  if (r != ERROR_SUCCESS)
457  {
459  goto done;
460  }
461 
462  sprintfW(name, format, dwIndex + 1);
463 
464  res = RegQueryValueExW(subkey, name, 0, 0, (LPBYTE)szSource, pcchSource);
465  if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
467 
468 done:
469  RegCloseKey(subkey);
471 
472  if (r == ERROR_SUCCESS)
473  {
474  if (szSource || !pcchSource) index++;
475  }
476  else if (dwIndex > index)
477  index = 0;
478 
479  return r;
480 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static UINT OpenSourceKey(LPCWSTR szProduct, HKEY *key, DWORD dwOptions, MSIINSTALLCONTEXT context, BOOL create)
Definition: source.c:54
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
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:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR szSource[]
Definition: automation.c:501
static UINT OpenNetworkSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:119
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:711
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:87
#define sprintfW
Definition: unicode.h:58
unsigned int UINT
Definition: ndis.h:50
static UINT OpenURLSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:132
Definition: name.c:36
GLuint res
Definition: glext.h:9613

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

◆ MsiSourceListGetInfoA()

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

Definition at line 485 of file source.c.

489 {
490  UINT ret;
491  LPWSTR product = NULL;
492  LPWSTR usersid = NULL;
493  LPWSTR property = NULL;
494  LPWSTR value = NULL;
495  DWORD len = 0;
496 
497  if (szValue && !pcchValue)
499 
500  if (szProduct) product = strdupAtoW(szProduct);
501  if (szUserSid) usersid = strdupAtoW(szUserSid);
502  if (szProperty) property = strdupAtoW(szProperty);
503 
504  ret = MsiSourceListGetInfoW(product, usersid, dwContext, dwOptions,
505  property, NULL, &len);
506  if (ret != ERROR_SUCCESS)
507  goto done;
508 
509  value = msi_alloc(++len * sizeof(WCHAR));
510  if (!value)
511  return ERROR_OUTOFMEMORY;
512 
513  *value = '\0';
514  ret = MsiSourceListGetInfoW(product, usersid, dwContext, dwOptions,
515  property, value, &len);
516  if (ret != ERROR_SUCCESS)
517  goto done;
518 
519  len = WideCharToMultiByte(CP_ACP, 0, value, -1, NULL, 0, NULL, NULL);
520  if (*pcchValue >= len)
521  WideCharToMultiByte(CP_ACP, 0, value, -1, szValue, len, NULL, NULL);
522  else if (szValue)
524 
525  *pcchValue = len - 1;
526 
527 done:
528  msi_free(product);
529  msi_free(usersid);
531  msi_free(value);
532  return ret;
533 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
UINT WINAPI MsiSourceListGetInfoW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szProperty, LPWSTR szValue, LPDWORD pcchValue)
Definition: source.c:538
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
__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
static const WCHAR szProperty[]
Definition: msipriv.h:1198
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:67
#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 538 of file source.c.

542 {
543  static const WCHAR mediapack[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0};
544  WCHAR *source, *ptr, squashed_pc[SQUASHED_GUID_SIZE];
545  HKEY sourcekey, media;
546  DWORD size;
547  UINT rc;
548 
549  TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szProperty));
550 
551  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
553 
554  if (szValue && !pcchValue)
556 
557  if (dwContext != MSIINSTALLCONTEXT_USERMANAGED &&
558  dwContext != MSIINSTALLCONTEXT_USERUNMANAGED &&
559  dwContext != MSIINSTALLCONTEXT_MACHINE)
561 
562  if (!szProperty)
564 
565  if (szUserSid)
566  FIXME("Unhandled UserSid %s\n",debugstr_w(szUserSid));
567 
568  rc = OpenSourceKey(szProduct, &sourcekey, dwOptions, dwContext, FALSE);
569  if (rc != ERROR_SUCCESS)
570  return rc;
571 
574  {
575  rc = OpenMediaSubkey(sourcekey, &media, FALSE);
576  if (rc != ERROR_SUCCESS)
577  {
578  RegCloseKey(sourcekey);
579  return ERROR_SUCCESS;
580  }
581 
583  szProperty = mediapack;
584 
585  RegQueryValueExW(media, szProperty, 0, 0, (LPBYTE)szValue, pcchValue);
587  }
590  {
592  0, 0, NULL, &size);
593  if (rc != ERROR_SUCCESS)
594  {
595  static WCHAR szEmpty[1] = { '\0' };
596  rc = ERROR_SUCCESS;
597  source = NULL;
598  ptr = szEmpty;
599  goto output_out;
600  }
601 
602  source = msi_alloc(size);
604  0, 0, (LPBYTE)source, &size);
605 
606  if (!*source)
607  {
608  msi_free(source);
609  RegCloseKey(sourcekey);
610  return ERROR_SUCCESS;
611  }
612 
614  {
615  if (*source != 'n' && *source != 'u' && *source != 'm')
616  {
617  msi_free(source);
618  RegCloseKey(sourcekey);
619  return ERROR_SUCCESS;
620  }
621 
622  ptr = source;
623  source[1] = '\0';
624  }
625  else
626  {
627  ptr = strrchrW(source, ';');
628  if (!ptr)
629  ptr = source;
630  else
631  ptr++;
632  }
633 output_out:
634  if (szValue)
635  {
636  if (strlenW(ptr) < *pcchValue)
637  lstrcpyW(szValue, ptr);
638  else
639  rc = ERROR_MORE_DATA;
640  }
641 
642  *pcchValue = lstrlenW(ptr);
643  msi_free(source);
644  }
646  {
647  *pcchValue = *pcchValue * sizeof(WCHAR);
648  rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, 0,
649  (LPBYTE)szValue, pcchValue);
650  if (rc != ERROR_SUCCESS && rc != ERROR_MORE_DATA)
651  {
652  *pcchValue = 0;
653  rc = ERROR_SUCCESS;
654  }
655  else
656  {
657  if (*pcchValue)
658  *pcchValue = (*pcchValue - 1) / sizeof(WCHAR);
659  if (szValue)
660  szValue[*pcchValue] = '\0';
661  }
662  }
663  else
664  {
665  FIXME("Unknown property %s\n",debugstr_w(szProperty));
667  }
668 
669  RegCloseKey(sourcekey);
670  return rc;
671 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
static const WCHAR INSTALLPROPERTY_PACKAGENAMEW[]
Definition: msi.h:265
#define ERROR_UNKNOWN_PROPERTY
Definition: winerror.h:966
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR INSTALLPROPERTY_MEDIAPACKAGEPATHW[]
Definition: msi.h:413
#define lstrlenW
Definition: compat.h:407
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:54
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR INSTALLPROPERTY_DISKPROMPTW[]
Definition: msi.h:417
static const WCHAR szEmpty[]
Definition: provider.c:47
__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:4116
static UINT OpenMediaSubkey(HKEY rootkey, HKEY *key, BOOL create)
Definition: source.c:106
__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 ERROR_MORE_DATA
Definition: dderror.h:13
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:711
#define lstrcpyW
Definition: compat.h:406
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:87
static const WCHAR szProperty[]
Definition: msipriv.h:1198
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
static void * msi_alloc(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1204

Referenced by ACTION_ResolveSource(), find_published_source(), 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 676 of file source.c.

679 {
680  UINT ret;
681  LPWSTR product = NULL;
682  LPWSTR usersid = NULL;
683  LPWSTR property = NULL;
684  LPWSTR value = NULL;
685 
686  if (szProduct) product = strdupAtoW(szProduct);
687  if (szUserSid) usersid = strdupAtoW(szUserSid);
688  if (szProperty) property = strdupAtoW(szProperty);
689  if (szValue) value = strdupAtoW(szValue);
690 
691  ret = MsiSourceListSetInfoW(product, usersid, dwContext, dwOptions,
692  property, value);
693 
694  msi_free(product);
695  msi_free(usersid);
697  msi_free(value);
698 
699  return ret;
700 }
DWORD dwOptions
Definition: solitaire.cpp:23
smooth NULL
Definition: ftsmooth.c:416
int ret
UINT WINAPI MsiSourceListSetInfoW(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szProperty, LPCWSTR szValue)
Definition: source.c:766
static const WCHAR szProperty[]
Definition: msipriv.h:1198
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:67

Referenced by init_functionpointers().

◆ MsiSourceListSetInfoW()

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

Definition at line 766 of file source.c.

769 {
770  static const WCHAR media_package[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0};
771  WCHAR squashed_pc[SQUASHED_GUID_SIZE];
772  HKEY sourcekey, media;
774  UINT rc;
775 
776  TRACE("%s %s %x %x %s %s\n", debugstr_w(szProduct), debugstr_w(szUserSid),
777  dwContext, dwOptions, debugstr_w(szProperty), debugstr_w(szValue));
778 
779  if (!szProduct || !squash_guid( szProduct, squashed_pc ))
781 
782  if (!szProperty)
784 
785  if (!szValue)
786  return ERROR_UNKNOWN_PROPERTY;
787 
788  if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
790 
791  if (dwOptions & MSICODE_PATCH)
792  {
793  FIXME("Unhandled options MSICODE_PATCH\n");
794  return ERROR_UNKNOWN_PATCH;
795  }
796 
797  property = szProperty;
799  property = media_package;
800 
801  rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE);
802  if (rc != ERROR_SUCCESS)
803  return rc;
804 
807  {
808  RegCloseKey(sourcekey);
810  }
811 
814  {
815  rc = OpenMediaSubkey(sourcekey, &media, TRUE);
816  if (rc == ERROR_SUCCESS)
817  {
818  rc = msi_reg_set_val_str(media, property, szValue);
820  }
821  }
823  {
824  DWORD size = (lstrlenW(szValue) + 1) * sizeof(WCHAR);
825  rc = RegSetValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0,
826  REG_SZ, (const BYTE *)szValue, size);
827  if (rc != ERROR_SUCCESS)
829  }
831  {
834  else
835  rc = msi_set_last_used_source(szProduct, szUserSid, dwContext,
836  dwOptions, szValue);
837  }
838  else
840 
841  RegCloseKey(sourcekey);
842  return rc;
843 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD dwOptions
Definition: solitaire.cpp:23
static const WCHAR INSTALLPROPERTY_PACKAGENAMEW[]
Definition: msi.h:265
#define ERROR_UNKNOWN_PROPERTY
Definition: winerror.h:966
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static const WCHAR INSTALLPROPERTY_MEDIAPACKAGEPATHW[]
Definition: msi.h:413
#define lstrlenW
Definition: compat.h:407
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:54
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value)
Definition: source.c:702
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:360
#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:4895
__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:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
#define SQUASHED_GUID_SIZE
Definition: msipriv.h:711
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
Definition: source.c:87
static const WCHAR szProperty[]
Definition: msipriv.h:1198
unsigned int UINT
Definition: ndis.h:50
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
#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 106 of file source.c.

107 {
108  UINT rc;
109  static const WCHAR media[] = {'M','e','d','i','a',0};
110 
111  if (create)
112  rc = RegCreateKeyW(rootkey, media, key);
113  else
114  rc = RegOpenKeyW(rootkey,media, key);
115 
116  return rc;
117 }
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
__u8 media
Definition: mkdosfs.c:367
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:7720
Definition: path.c:42

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

◆ OpenNetworkSubkey()

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

Definition at line 119 of file source.c.

120 {
121  UINT rc;
122  static const WCHAR net[] = {'N','e','t',0};
123 
124  if (create)
125  rc = RegCreateKeyW(rootkey, net, key);
126  else
127  rc = RegOpenKeyW(rootkey, net, key);
128 
129  return rc;
130 }
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
static TNetwork net
Definition: tncon.cpp:351
unsigned int UINT
Definition: ndis.h:50
static const struct access_res create[16]
Definition: package.c:7720
Definition: path.c:42

Referenced by MsiSourceListAddSourceExW(), and MsiSourceListEnumSourcesW().

◆ OpenSourceKey()

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

Definition at line 54 of file source.c.

56 {
57  HKEY rootkey = 0;
59 
61  {
63  rc = MSIREG_OpenUserPatchesKey(szProduct, &rootkey, create);
64  else
65  rc = MSIREG_OpenProductKey(szProduct, NULL, context,
66  &rootkey, create);
67  }
69  {
71  rc = MSIREG_OpenUserPatchesKey(szProduct, &rootkey, create);
72  else
73  rc = MSIREG_OpenProductKey(szProduct, NULL, context,
74  &rootkey, create);
75  }
77  {
79  rc = MSIREG_OpenPatchesKey(szProduct, &rootkey, create);
80  else
81  rc = MSIREG_OpenProductKey(szProduct, NULL, context,
82  &rootkey, create);
83  }
84 
85  if (rc != ERROR_SUCCESS)
86  {
88  return ERROR_UNKNOWN_PATCH;
89  else
90  return ERROR_UNKNOWN_PRODUCT;
91  }
92 
93  if (create)
94  rc = RegCreateKeyW(rootkey, szSourceList, key);
95  else
96  {
97  rc = RegOpenKeyW(rootkey,szSourceList, key);
98  if (rc != ERROR_SUCCESS)
100  }
101  RegCloseKey(rootkey);
102 
103  return rc;
104 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: http.c:6587
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR szSourceList[]
Definition: msipriv.h:1121
UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:901
#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:492
#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
UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) DECLSPEC_HIDDEN
Definition: registry.c:542
static const struct access_res create[16]
Definition: package.c:7720
Definition: path.c:42

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 132 of file source.c.

133 {
134  UINT rc;
135  static const WCHAR URL[] = {'U','R','L',0};
136 
137  if (create)
138  rc = RegCreateKeyW(rootkey, URL, key);
139  else
140  rc = RegOpenKeyW(rootkey, URL, key);
141 
142  return rc;
143 }
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:7720
Definition: path.c:42

Referenced by MsiSourceListAddSourceExW(), and MsiSourceListEnumSourcesW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msi  )