Author: winesync
Date: Thu Nov 29 12:44:39 2007
New Revision: 30856
URL:
http://svn.reactos.org/svn/reactos?rev=30856&view=rev
Log:
Autosyncing with Wine HEAD
Modified:
trunk/reactos/dll/win32/advpack/advpack.c
trunk/reactos/dll/win32/advpack/advpack.rbuild
trunk/reactos/dll/win32/advpack/files.c
trunk/reactos/dll/win32/advpack/install.c
trunk/reactos/dll/win32/advpack/reg.c
Modified: trunk/reactos/dll/win32/advpack/advpack.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/advpack.…
==============================================================================
--- trunk/reactos/dll/win32/advpack/advpack.c (original)
+++ trunk/reactos/dll/win32/advpack/advpack.c Thu Nov 29 12:44:39 2007
@@ -49,6 +49,17 @@
'C','o','m','p','o','n','e','n','t','s',0
};
+/* Strip single quotes from a token - note size includes NULL */
+static void strip_quotes(WCHAR *buffer, DWORD *size)
+{
+ if (buffer[0] == '\'' && (*size > 1) &&
buffer[*size-2]=='\'')
+ {
+ *size -= 2;
+ buffer[*size] = 0x00;
+ memmove(buffer, buffer + 1, *size * sizeof(WCHAR));
+ }
+}
+
/* parses the destination directory parameters from pszSection
* the parameters are of the form: root,key,value,unknown,fallback
* we first read the reg value root\\key\\value and if that fails,
@@ -68,8 +79,11 @@
/* load the destination parameters */
SetupFindFirstLineW(hInf, pszSection, NULL, &context);
SetupGetStringFieldW(&context, 1, prefix, PREFIX_LEN, &size);
+ strip_quotes(prefix, &size);
SetupGetStringFieldW(&context, 2, key, MAX_PATH, &size);
+ strip_quotes(key, &size);
SetupGetStringFieldW(&context, 3, value, MAX_PATH, &size);
+ strip_quotes(value, &size);
if (!lstrcmpW(prefix, hklm))
root = HKEY_LOCAL_MACHINE;
@@ -84,7 +98,8 @@
if (RegOpenKeyW(root, key, &subkey) ||
RegQueryValueExW(subkey, value, NULL, NULL, (LPBYTE)pszBuffer, &size))
{
- SetupGetStringFieldW(&context, 5, pszBuffer, dwSize, NULL);
+ SetupGetStringFieldW(&context, 5, pszBuffer, dwSize, &size);
+ strip_quotes(pszBuffer, &size);
}
RegCloseKey(subkey);
@@ -116,6 +131,7 @@
do
{
LPWSTR value, ptr, key, key_copy = NULL;
+ DWORD flags = 0;
SetupGetLineTextW(&context, NULL, NULL, NULL,
line, MAX_FIELD_LENGTH, &size);
@@ -141,16 +157,22 @@
while (*value == ' ')
value++;
- /* FIXME: need to check the query option */
+ /* Extract the flags */
ptr = strchrW(value, ',');
- if (ptr)
+ if (ptr) {
*ptr = '\0';
+ flags = atolW(ptr+1);
+ }
/* set dest to pszWorkingDir if key is SourceDir */
if (pszWorkingDir && !lstrcmpiW(value, source_dir))
lstrcpynW(dest, pszWorkingDir, MAX_PATH);
else
get_dest_dir(hInf, value, dest, MAX_PATH);
+
+ /* If prompting required, provide dialog to request path */
+ if (flags & 0x04)
+ FIXME("Need to support changing paths - default will be used\n");
/* set all ldids to dest */
while ((ptr = get_parameter(&key, ',')))
@@ -365,7 +387,7 @@
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
set_ldids(*phInf, pszInstallSection, NULL);
-
+
return S_OK;
}
@@ -672,7 +694,7 @@
else
res = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
}
-
+
HeapFree(GetProcessHeap(), 0, bufferW);
}
@@ -789,7 +811,7 @@
else
res = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
}
-
+
HeapFree(GetProcessHeap(), 0, bufferW);
}
@@ -850,7 +872,7 @@
return SPAPI_E_LINE_NOT_FOUND;
}
- return S_OK;
+ return S_OK;
}
/***********************************************************************
Modified: trunk/reactos/dll/win32/advpack/advpack.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/advpack.…
==============================================================================
--- trunk/reactos/dll/win32/advpack/advpack.rbuild (original)
+++ trunk/reactos/dll/win32/advpack/advpack.rbuild Thu Nov 29 12:44:39 2007
@@ -1,13 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="advpack" type="win32dll"
baseaddress="${BASEADDRESS_ADVPACK}" installbase="system32"
installname="advpack.dll" allowwarnings="true">
<importlibrary definition="advpack.spec.def" />
<include base="advpack">.</include>
<include base="ReactOS">include/reactos/wine</include>
- <define name="__REACTOS__" />
<define name="__WINESRC__" />
- <define name="__USE_W32API" />
- <define name="_WIN32_IE">0x600</define>
- <define name="_WIN32_WINNT">0x501</define>
- <define name="WINVER">0x501</define>
+ <define name="WINVER">0x600</define>
+ <define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>ole32</library>
<library>setupapi</library>
Modified: trunk/reactos/dll/win32/advpack/files.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/files.c?…
==============================================================================
--- trunk/reactos/dll/win32/advpack/files.c (original)
+++ trunk/reactos/dll/win32/advpack/files.c Thu Nov 29 12:44:39 2007
@@ -29,6 +29,7 @@
#include "winternl.h"
#include "setupapi.h"
#include "advpub.h"
+#include "fdi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "advpack_private.h"
@@ -109,7 +110,7 @@
* NOTES
* If the INI file does not exist before adding entries to it, the file
* will be created.
- *
+ *
* If lpcszBackupDir is NULL, the INI file is assumed to exist in
* c:\windows or created there if it does not exist.
*/
@@ -122,7 +123,7 @@
static const WCHAR szBackupEntry[] = {
'-','1',',','0',',','0',',','0',',','0',',','0',',','-','1',0
};
-
+
static const WCHAR backslash[] = {'\\',0};
static const WCHAR ini[] = {'.','i','n','i',0};
static const WCHAR backup[] =
{'b','a','c','k','u','p',0};
@@ -263,7 +264,7 @@
if (!lpszSourceDir || !lpszSourceFile || !lpszDestDir)
return E_INVALIDARG;
-
+
fileQueue = SetupOpenFileQueue();
if (fileQueue == INVALID_HANDLE_VALUE)
return HRESULT_FROM_WIN32(GetLastError());
@@ -320,9 +321,9 @@
done:
SetupTermDefaultQueueCallback(pContext);
SetupCloseFileQueue(fileQueue);
-
+
HeapFree(GetProcessHeap(), 0, szDestFilename);
-
+
return HRESULT_FROM_WIN32(dwLastError);
}
@@ -385,7 +386,7 @@
ret = S_OK;
}
}
-
+
return ret;
}
@@ -419,7 +420,7 @@
* pszFileOrDirName [I] Name of file or directory to delete
* dwFlags [I] Flags; see include/advpub.h
*
- * RETURNS
+ * RETURNS
* Success: S_OK
* Failure: E_FAIL
*
@@ -432,9 +433,9 @@
{
WCHAR fname[MAX_PATH];
HRESULT ret = E_FAIL;
-
+
TRACE("(%s, %d)\n", debugstr_w(pszFileOrDirName), dwFlags);
-
+
if (dwFlags)
FIXME("Flags ignored!\n");
@@ -515,28 +516,29 @@
/* The following defintions were copied from dlls/cabinet/cabinet.h */
-/* EXTRACTdest flags */
+/* SESSION Operation */
#define EXTRACT_FILLFILELIST 0x00000001
#define EXTRACT_EXTRACTFILES 0x00000002
-struct ExtractFileList {
- LPSTR filename;
- struct ExtractFileList *next;
- BOOL unknown; /* always 1L */
-} ;
-
-/* the first parameter of the function Extract */
+struct FILELIST{
+ LPSTR FileName;
+ struct FILELIST *next;
+ BOOL DoExtract;
+};
+
typedef struct {
- long result1; /* 0x000 */
- long unknown1[3]; /* 0x004 */
- struct ExtractFileList *filelist; /* 0x010 */
- long filecount; /* 0x014 */
- DWORD flags; /* 0x018 */
- char directory[0x104]; /* 0x01c */
- char lastfile[0x20c]; /* 0x120 */
-} EXTRACTdest;
-
-static HRESULT (WINAPI *pExtract)(EXTRACTdest*, LPCSTR);
+ INT FileSize;
+ ERF Error;
+ struct FILELIST *FileList;
+ INT FileCount;
+ INT Operation;
+ CHAR Destination[MAX_PATH];
+ CHAR CurrentFile[MAX_PATH];
+ CHAR Reserved[MAX_PATH];
+ struct FILELIST *FilterList;
+} SESSION;
+
+static HRESULT (WINAPI *pExtract)(SESSION*, LPCSTR);
/* removes legal characters before and after file list, and
* converts the file list to a NULL-separated list
@@ -547,7 +549,7 @@
const char *first = FileList;
const char *last = FileList + strlen(FileList) - 1;
LPSTR szConvertedList, temp;
-
+
/* any number of these chars before the list is OK */
while (first < last && (*first == ' ' || *first == '\t' ||
*first == ':'))
first++;
@@ -572,7 +574,7 @@
HeapFree(GetProcessHeap(), 0, szConvertedList);
return NULL;
}
-
+
*dwNumFiles = 1;
/* convert the colons to double-null termination */
@@ -591,9 +593,9 @@
return szConvertedList;
}
-static void free_file_node(struct ExtractFileList *pNode)
-{
- HeapFree(GetProcessHeap(), 0, pNode->filename);
+static void free_file_node(struct FILELIST *pNode)
+{
+ HeapFree(GetProcessHeap(), 0, pNode->FileName);
HeapFree(GetProcessHeap(), 0, pNode);
}
@@ -619,46 +621,32 @@
return FALSE;
}
-/* removes nodes from the linked list that aren't specified in szFileList
- * returns the number of files that are in both the linked list and szFileList
- */
-static DWORD fill_file_list(EXTRACTdest *extractDest, LPCSTR szCabName, LPCSTR
szFileList)
+
+/* returns the number of files that are in both the linked list and szFileList */
+static DWORD fill_file_list(SESSION *session, LPCSTR szCabName, LPCSTR szFileList)
{
DWORD dwNumFound = 0;
- struct ExtractFileList *pNode;
- struct ExtractFileList *prev = NULL;
-
- extractDest->flags |= EXTRACT_FILLFILELIST;
- if (pExtract(extractDest, szCabName))
- {
- extractDest->flags &= ~EXTRACT_FILLFILELIST;
+ struct FILELIST *pNode;
+
+ session->Operation |= EXTRACT_FILLFILELIST;
+ if (pExtract(session, szCabName))
+ {
+ session->Operation &= ~EXTRACT_FILLFILELIST;
return -1;
}
- pNode = extractDest->filelist;
+ pNode = session->FileList;
while (pNode)
{
- if (file_in_list(pNode->filename, szFileList))
- {
- prev = pNode;
- pNode = pNode->next;
+ if (!file_in_list(pNode->FileName, szFileList))
+ pNode->DoExtract = FALSE;
+ else
dwNumFound++;
- }
- else if (prev)
- {
- prev->next = pNode->next;
- free_file_node(pNode);
- pNode = prev->next;
- }
- else
- {
- extractDest->filelist = pNode->next;
- free_file_node(pNode);
- pNode = extractDest->filelist;
- }
- }
-
- extractDest->flags &= ~EXTRACT_FILLFILELIST;
+
+ pNode = pNode->next;
+ }
+
+ session->Operation &= ~EXTRACT_FILLFILELIST;
return dwNumFound;
}
@@ -689,8 +677,8 @@
*/
HRESULT WINAPI ExtractFilesA(LPCSTR CabName, LPCSTR ExpandDir, DWORD Flags,
LPCSTR FileList, LPVOID LReserved, DWORD Reserved)
-{
- EXTRACTdest extractDest;
+{
+ SESSION session;
HMODULE hCabinet;
HRESULT res = S_OK;
DWORD dwFileCount = 0;
@@ -717,8 +705,8 @@
goto done;
}
- ZeroMemory(&extractDest, sizeof(EXTRACTdest));
- lstrcpyA(extractDest.directory, ExpandDir);
+ ZeroMemory(&session, sizeof(SESSION));
+ lstrcpyA(session.Destination, ExpandDir);
if (FileList)
{
@@ -729,7 +717,7 @@
goto done;
}
- dwFilesFound = fill_file_list(&extractDest, CabName, szConvertedList);
+ dwFilesFound = fill_file_list(&session, CabName, szConvertedList);
if (dwFilesFound != dwFileCount)
{
res = E_FAIL;
@@ -737,15 +725,15 @@
}
}
else
- extractDest.flags |= EXTRACT_FILLFILELIST;
-
- extractDest.flags |= EXTRACT_EXTRACTFILES;
- res = pExtract(&extractDest, CabName);
-
- if (extractDest.filelist)
- {
- struct ExtractFileList* curr = extractDest.filelist;
- struct ExtractFileList* next;
+ session.Operation |= EXTRACT_FILLFILELIST;
+
+ session.Operation |= EXTRACT_EXTRACTFILES;
+ res = pExtract(&session, CabName);
+
+ if (session.FileList)
+ {
+ struct FILELIST *curr = session.FileList;
+ struct FILELIST *next;
while (curr)
{
@@ -824,7 +812,7 @@
RtlFreeUnicodeString(&basename);
return hr;
-}
+}
/***********************************************************************
* FileSaveRestoreW (ADVPACK.@)
Modified: trunk/reactos/dll/win32/advpack/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/install.…
==============================================================================
--- trunk/reactos/dll/win32/advpack/install.c (original)
+++ trunk/reactos/dll/win32/advpack/install.c Thu Nov 29 12:44:39 2007
@@ -82,7 +82,7 @@
DWORD size;
BOOL ok = SetupFindFirstLineW(hinf, field, NULL, &context);
-
+
for (; ok; ok = SetupFindNextLine(&context, &context))
{
WCHAR directory[MAX_INF_STRING_LENGTH];
@@ -148,7 +148,7 @@
HRESULT hr = S_OK;
BOOL ok = SetupFindFirstLineW(hinf, field, NULL, &context);
-
+
for (; ok; ok = SetupFindNextLine(&context, &context))
{
WCHAR buffer[MAX_INF_STRING_LENGTH];
@@ -633,7 +633,7 @@
RtlCreateUnicodeStringFromAsciiz(&inf, pCab->pszInf);
RtlCreateUnicodeStringFromAsciiz(§ion, pCab->pszSection);
-
+
MultiByteToWideChar(CP_ACP, 0, pCab->szSrcPath, -1, cabinfo.szSrcPath,
sizeof(cabinfo.szSrcPath) / sizeof(WCHAR));
@@ -654,14 +654,14 @@
/***********************************************************************
* ExecuteCabW (ADVPACK.@)
- *
+ *
* Installs the INF file extracted from a specified cabinet file.
- *
+ *
* PARAMS
* hwnd [I] Handle to the window used for the display.
* pCab [I] Information about the cabinet file.
* pReserved [I] Reserved. Must be NULL.
- *
+ *
* RETURNS
* Success: S_OK.
* Failure: E_FAIL.
Modified: trunk/reactos/dll/win32/advpack/reg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advpack/reg.c?re…
==============================================================================
--- trunk/reactos/dll/win32/advpack/reg.c (original)
+++ trunk/reactos/dll/win32/advpack/reg.c Thu Nov 29 12:44:39 2007
@@ -77,7 +77,7 @@
if(!rsrc_data || !rsrc_size) {
ERR("Can't load REGINST resource\n");
goto error;
- }
+ }
if((hf = CreateFileW(ini_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) {
@@ -213,7 +213,7 @@
* hm [I] Module that contains the REGINST resouce.
* pszSection [I] The INF section to execute.
* pstTable [I] Table of string substitutions.
- *
+ *
* RETURNS
* Success: S_OK.
* Failure: E_FAIL.
@@ -239,11 +239,11 @@
for(i = 0; i < pstTable->cEntries; i++)
{
WCHAR tmp_value[MAX_PATH + 2];
-
+
tmp_value[0] = '\"';
lstrcpyW(tmp_value + 1, pstTable->pse[i].pszValue);
lstrcatW(tmp_value, quote);
-
+
WritePrivateProfileStringW(Strings, pstTable->pse[i].pszName, tmp_value,
tmp_ini_path);
}
}
@@ -307,8 +307,8 @@
HRESULT WINAPI RegRestoreAllW(HWND hWnd, LPWSTR pszTitleString, HKEY hkBackupKey)
{
FIXME("(%p, %s, %p) stub\n", hWnd, debugstr_w(pszTitleString),
hkBackupKey);
-
- return E_FAIL;
+
+ return E_FAIL;
}
/***********************************************************************
@@ -354,9 +354,9 @@
* hkBackupKey [I] Key used to store the backup data.
* pcszRootKey [I] Root key of the registry value
* pcszSubKey [I] Sub key of the registry value.
- * pcszValueName [I] Value to save or restore.
+ * pcszValueName [I] Value to save or restore.
* dwFlags [I] See advpub.h.
- *
+ *
* RETURNS
* Success: S_OK.
* Failure: E_FAIL.
@@ -372,7 +372,7 @@
hkBackupKey, debugstr_w(pcszRootKey), debugstr_w(pcszSubKey),
debugstr_w(pcszValueName), dwFlags);
- return E_FAIL;
+ return E_FAIL;
}
/***********************************************************************
@@ -434,5 +434,5 @@
debugstr_w(pszINF), debugstr_w(pszSection),
hHKLMBackKey, hHKCUBackKey, dwFlags);
- return E_FAIL;
-}
+ return E_FAIL;
+}