James Hawkins : advpack: Formalize the SESSION struct.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Aug 23 07:25:58 CDT 2007
Module: wine
Branch: master
Commit: 5b62c8461c85985df69316168f9235ee540676b2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b62c8461c85985df69316168f9235ee540676b2
Author: James Hawkins <truiken at gmail.com>
Date: Wed Aug 22 17:41:04 2007 -0700
advpack: Formalize the SESSION struct.
---
dlls/advpack/files.c | 82 +++++++++++++++++++++++++------------------------
1 files changed, 42 insertions(+), 40 deletions(-)
diff --git a/dlls/advpack/files.c b/dlls/advpack/files.c
index 163f994..d0f948c 100644
--- a/dlls/advpack/files.c
+++ b/dlls/advpack/files.c
@@ -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"
@@ -515,28 +516,29 @@ HRESULT WINAPI DelNodeRunDLL32W(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT
/* 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 */
-} ;
+struct FILELIST{
+ LPSTR FileName;
+ struct FILELIST *next;
+ BOOL Extracted;
+};
-/* the first parameter of the function Extract */
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
@@ -591,9 +593,9 @@ static LPSTR convert_file_list(LPCSTR FileList, DWORD *dwNumFiles)
return szConvertedList;
}
-static void free_file_node(struct ExtractFileList *pNode)
+static void free_file_node(struct FILELIST *pNode)
{
- HeapFree(GetProcessHeap(), 0, pNode->filename);
+ HeapFree(GetProcessHeap(), 0, pNode->FileName);
HeapFree(GetProcessHeap(), 0, pNode);
}
@@ -622,23 +624,23 @@ static BOOL file_in_list(LPCSTR szFile, LPCSTR szFileList)
/* 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)
+static DWORD fill_file_list(SESSION *session, LPCSTR szCabName, LPCSTR szFileList)
{
DWORD dwNumFound = 0;
- struct ExtractFileList *pNode;
- struct ExtractFileList *prev = NULL;
+ struct FILELIST *pNode;
+ struct FILELIST *prev = NULL;
- extractDest->flags |= EXTRACT_FILLFILELIST;
- if (pExtract(extractDest, szCabName))
+ session->Operation |= EXTRACT_FILLFILELIST;
+ if (pExtract(session, szCabName))
{
- extractDest->flags &= ~EXTRACT_FILLFILELIST;
+ session->Operation &= ~EXTRACT_FILLFILELIST;
return -1;
}
- pNode = extractDest->filelist;
+ pNode = session->FileList;
while (pNode)
{
- if (file_in_list(pNode->filename, szFileList))
+ if (file_in_list(pNode->FileName, szFileList))
{
prev = pNode;
pNode = pNode->next;
@@ -652,13 +654,13 @@ static DWORD fill_file_list(EXTRACTdest *extractDest, LPCSTR szCabName, LPCSTR s
}
else
{
- extractDest->filelist = pNode->next;
+ session->FileList = pNode->next;
free_file_node(pNode);
- pNode = extractDest->filelist;
+ pNode = session->FileList;
}
}
- extractDest->flags &= ~EXTRACT_FILLFILELIST;
+ session->Operation &= ~EXTRACT_FILLFILELIST;
return dwNumFound;
}
@@ -690,7 +692,7 @@ static DWORD fill_file_list(EXTRACTdest *extractDest, LPCSTR szCabName, LPCSTR s
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 +719,8 @@ HRESULT WINAPI ExtractFilesA(LPCSTR CabName, LPCSTR ExpandDir, DWORD Flags,
goto done;
}
- ZeroMemory(&extractDest, sizeof(EXTRACTdest));
- lstrcpyA(extractDest.directory, ExpandDir);
+ ZeroMemory(&session, sizeof(SESSION));
+ lstrcpyA(session.Destination, ExpandDir);
if (FileList)
{
@@ -729,7 +731,7 @@ HRESULT WINAPI ExtractFilesA(LPCSTR CabName, LPCSTR ExpandDir, DWORD Flags,
goto done;
}
- dwFilesFound = fill_file_list(&extractDest, CabName, szConvertedList);
+ dwFilesFound = fill_file_list(&session, CabName, szConvertedList);
if (dwFilesFound != dwFileCount)
{
res = E_FAIL;
@@ -737,15 +739,15 @@ HRESULT WINAPI ExtractFilesA(LPCSTR CabName, LPCSTR ExpandDir, DWORD Flags,
}
}
else
- extractDest.flags |= EXTRACT_FILLFILELIST;
+ session.Operation |= EXTRACT_FILLFILELIST;
- extractDest.flags |= EXTRACT_EXTRACTFILES;
- res = pExtract(&extractDest, CabName);
+ session.Operation |= EXTRACT_EXTRACTFILES;
+ res = pExtract(&session, CabName);
- if (extractDest.filelist)
+ if (session.FileList)
{
- struct ExtractFileList* curr = extractDest.filelist;
- struct ExtractFileList* next;
+ struct FILELIST *curr = session.FileList;
+ struct FILELIST *next;
while (curr)
{
More information about the wine-cvs
mailing list