ReactOS  0.4.15-dev-1171-gab82533
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:51
#define GetProcAddress(x, y)
Definition: compat.h:501
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 200 of file install.c.

201 {
202  LPWSTR token = *params;
203 
204  if (!*params)
205  return NULL;
206 
207  if (quoted && *token == '"')
208  {
209  WCHAR *end = wcschr(token + 1, '"');
210  if (end)
211  {
212  *end = 0;
213  *params = end + 1;
214  token = token + 1;
215  }
216  }
217 
219  if (*params)
220  *(*params)++ = '\0';
221 
222  if (!*token)
223  return NULL;
224 
225  return token;
226 }
static const WCHAR separator[]
Definition: asmname.c:65
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
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:111
#define CP_ACP
Definition: compat.h:109
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 894 of file install.c.

895 {
896  STARTUPINFOW si;
898 
899  if (phEXE) *phEXE = NULL;
900 
901  ZeroMemory(&pi, sizeof(pi));
902  ZeroMemory(&si, sizeof(si));
903  si.cb = sizeof(si);
904 
907  NULL, dir, &si, &pi))
908  {
910  }
911 
912  CloseHandle(pi.hThread);
913 
914  if (phEXE)
915  {
916  *phEXE = pi.hProcess;
917  return S_ASYNCHRONOUS;
918  }
919 
920  /* wait for the child process to finish */
921  WaitForSingleObject(pi.hProcess, INFINITE);
922  CloseHandle(pi.hProcess);
923 
924  return S_OK;
925 }
#define CloseHandle
Definition: compat.h:487
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
Definition: ftp_var.h:139
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define ZeroMemory
Definition: winbase.h:1648
#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
#define FALSE
Definition: types.h:117
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:4595
DWORD cb
Definition: winbase.h:830
static refpint_t pi[]
Definition: server.c:96
#define S_ASYNCHRONOUS
Definition: advpub.h:29
#define S_OK
Definition: intsafe.h:51
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 = wcschr(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 = wcschr(value, ',');
162  if (ptr) {
163  *ptr = '\0';
164  flags = wcstol(ptr+1, NULL, 10);
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 = wcstol(ptr, NULL, 10);
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:7094
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define lstrcpynW
Definition: compat.h:486
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
BOOL WINAPI SetupSetDirectoryIdW(HINF hinf, DWORD id, PCWSTR dir)
Definition: dirid.c:256
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: parser.c:43
#define MAX_PATH
Definition: compat.h:34
#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:200
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:483
Definition: path.c:41
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().