ReactOS  0.4.12-dev-685-gf36cbf7
advpack_private.h File Reference
#include "wine/heap.h"
Include dependency graph for advpack_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

HRESULT do_ocx_reg (HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param) DECLSPEC_HIDDEN
 
LPWSTR get_parameter (LPWSTR *params, WCHAR separator, BOOL quoted) DECLSPEC_HIDDEN
 
void set_ldids (HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir) DECLSPEC_HIDDEN
 
HRESULT launch_exe (LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE) DECLSPEC_HIDDEN
 
static charheap_strdupWtoA (const WCHAR *str)
 

Function Documentation

◆ do_ocx_reg()

HRESULT do_ocx_reg ( HMODULE  hocx,
BOOL  do_reg,
const WCHAR flags,
const WCHAR param 
)

Definition at line 442 of file advpack.c.

443 {
444  DLLREGISTER reg_func;
445 
446  if (do_reg)
447  reg_func = (DLLREGISTER)GetProcAddress(hocx, "DllRegisterServer");
448  else
449  reg_func = (DLLREGISTER)GetProcAddress(hocx, "DllUnregisterServer");
450 
451  if (!reg_func)
452  return E_FAIL;
453 
454  reg_func();
455  return S_OK;
456 }
#define E_FAIL
Definition: ddrawi.h:102
#define S_OK
Definition: intsafe.h:59
#define GetProcAddress(x, y)
Definition: compat.h:410
HRESULT(WINAPI * DLLREGISTER)(void)
Definition: advpack.c:38

Referenced by register_ocxs_callback(), and RegisterOCX().

◆ get_parameter()

LPWSTR get_parameter ( LPWSTR params,
WCHAR  separator,
BOOL  quoted 
)

Definition at line 201 of file install.c.

202 {
203  LPWSTR token = *params;
204 
205  if (!*params)
206  return NULL;
207 
208  if (quoted && *token == '"')
209  {
210  WCHAR *end = strchrW(token + 1, '"');
211  if (end)
212  {
213  *end = 0;
214  *params = end + 1;
215  token = token + 1;
216  }
217  }
218 
220  if (*params)
221  *(*params)++ = '\0';
222 
223  if (!*token)
224  return NULL;
225 
226  return token;
227 }
static const WCHAR separator[]
Definition: asmname.c:63
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
GLuint GLuint end
Definition: gl.h:1545
GLenum const GLfloat * params
Definition: glext.h:5645
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
smooth NULL
Definition: ftsmooth.c:416
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DelNodeRunDLL32W(), LaunchINFSectionExW(), LaunchINFSectionW(), RegisterOCX(), and set_ldids().

◆ heap_strdupWtoA()

static char* heap_strdupWtoA ( const WCHAR str)
inlinestatic

Definition at line 32 of file advpack_private.h.

33 {
34  char *ret = NULL;
35 
36  if(str) {
37  size_t size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
38  ret = heap_alloc(size);
39  if(ret)
41  }
42 
43  return ret;
44 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
int ret

Referenced by CommitUrlCacheEntryW(), exec_fontname(), ExtractFilesW(), FindFirstUrlCacheEntryW(), FTP_SendCommand(), get_channel_http_header(), get_doc_string(), INTERNET_SendCallback(), is_supported_doc_mime(), nsChannel_AsyncOpen(), nsChannelBSC_on_progress(), query_global_option(), read_stream_data(), save_persistent_cookie(), and visit_http_headers().

◆ launch_exe()

HRESULT launch_exe ( LPCWSTR  cmd,
LPCWSTR  dir,
HANDLE phEXE 
)

Definition at line 895 of file install.c.

896 {
897  STARTUPINFOW si;
899 
900  if (phEXE) *phEXE = NULL;
901 
902  ZeroMemory(&pi, sizeof(pi));
903  ZeroMemory(&si, sizeof(si));
904  si.cb = sizeof(si);
905 
908  NULL, dir, &si, &pi))
909  {
911  }
912 
913  CloseHandle(pi.hThread);
914 
915  if (phEXE)
916  {
917  *phEXE = pi.hProcess;
918  return S_ASYNCHRONOUS;
919  }
920 
921  /* wait for the child process to finish */
922  WaitForSingleObject(pi.hProcess, INFINITE);
923  CloseHandle(pi.hProcess);
924 
925  return S_OK;
926 }
#define CloseHandle
Definition: compat.h:398
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
Definition: ftp_var.h:139
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
#define CREATE_DEFAULT_ERROR_MODE
Definition: winbase.h:194
#define CREATE_NEW_PROCESS_GROUP
Definition: winbase.h:185
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4623
DWORD cb
Definition: winbase.h:817
#define S_ASYNCHRONOUS
Definition: advpub.h:29
static DWORD pi
Definition: protocol.c:150
#define S_OK
Definition: intsafe.h:59
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define INFINITE
Definition: serial.h:102

Referenced by run_setup_commands_callback(), RunSetupCommandW(), and UserInstStubWrapperW().

◆ set_ldids()

void set_ldids ( HINF  hInf,
LPCWSTR  pszInstallSection,
LPCWSTR  pszWorkingDir 
)

Definition at line 109 of file advpack.c.

110 {
115  DWORD size;
116  int ldid;
117 
118  static const WCHAR source_dir[] = {'S','o','u','r','c','e','D','i','r',0};
119 
120  static const WCHAR custDestW[] = {
121  'C','u','s','t','o','m','D','e','s','t','i','n','a','t','i','o','n',0
122  };
123 
124  if (!SetupGetLineTextW(NULL, hInf, pszInstallSection, custDestW,
126  return;
127 
128  if (!SetupFindFirstLineW(hInf, field, NULL, &context))
129  return;
130 
131  do
132  {
133  LPWSTR value, ptr, key, key_copy = NULL;
134  DWORD flags = 0;
135 
138 
139  /* SetupGetLineTextW returns the value if there is only one key, but
140  * returns the whole line if there is more than one key
141  */
142  if (!(value = strchrW(line, '=')))
143  {
145  key = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
146  key_copy = key;
148  value = line;
149  }
150  else
151  {
152  key = line;
153  *(value++) = '\0';
154  }
155 
156  /* remove leading whitespace from the value */
157  while (*value == ' ')
158  value++;
159 
160  /* Extract the flags */
161  ptr = strchrW(value, ',');
162  if (ptr) {
163  *ptr = '\0';
164  flags = atolW(ptr+1);
165  }
166 
167  /* set dest to pszWorkingDir if key is SourceDir */
168  if (pszWorkingDir && !lstrcmpiW(value, source_dir))
169  lstrcpynW(dest, pszWorkingDir, MAX_PATH);
170  else
171  get_dest_dir(hInf, value, dest, MAX_PATH);
172 
173  /* If prompting required, provide dialog to request path */
174  if (flags & 0x04)
175  FIXME("Need to support changing paths - default will be used\n");
176 
177  /* set all ldids to dest */
178  while ((ptr = get_parameter(&key, ',', FALSE)))
179  {
180  ldid = atolW(ptr);
181  SetupSetDirectoryIdW(hInf, ldid, dest);
182  }
183  HeapFree(GetProcessHeap(), 0, key_copy);
184  } while (SetupFindNextLine(&context, &context));
185 }
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
Definition: http.c:6587
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define lstrcpynW
Definition: compat.h:397
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
WINE_UNICODE_INLINE long int atolW(const WCHAR *str)
Definition: unicode.h:310
BOOL WINAPI SetupSetDirectoryIdW(HINF hinf, DWORD id, PCWSTR dir)
Definition: dirid.c:256
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: parser.c:43
#define MAX_PATH
Definition: compat.h:26
#define MAX_FIELD_LENGTH
Definition: advpack.c:40
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
char line[200]
Definition: main.c:97
HKEY key
Definition: reg.c:42
LPWSTR get_parameter(LPWSTR *params, WCHAR separator, BOOL quoted) DECLSPEC_HIDDEN
Definition: install.c:201
GLsizei const GLfloat * value
Definition: glext.h:6069
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
static void get_dest_dir(HINF hInf, PCWSTR pszSection, PWSTR pszBuffer, DWORD dwSize)
Definition: advpack.c:68
static char * dest
Definition: rtl.c:135
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: path.c:42
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
Definition: parser.c:1756
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by install_init(), OpenINFEngineW(), and TranslateInfStringW().