Sync to Wine-20050930:

Aric Stewart <aric@codeweavers.com>
- Add the GUID for Patch files so that they can be opened as well. Looks
  like the database structure is pretty much the same.
- Implement MsiReinstallFeature.
- Be sure to null terminate the string in MsiGetProductInfoA after the
  W->A conversion using MsiGetProductInfoW if there is space.
- Added stub implementations for MsiEnumPatchesA/W.
Alexandre Julliard <julliard@winehq.org>
- We are no longer generating .dbg.c files.
- Use a more portable scheme for storing the name of a critical
  section.
- Get rid of a couple of non-portable long long constants.
- Fixed memory leak introduced in previous change.
- Avoid non-portable va_list manipulations.
Milko Krachounov <milko@3mhz.net>
- Bulgarian resources for mpr, msi, user, commdlg, oleaut32, shdocvw,
  shell32, comctl32, msrle32, mshtml, winspool, wineps, serialui,
  setupapi, wininet, regedit, uninstaller, notepad, winecfg and
  winhelp.
Jan Van Buggenhout <Chipzz@ULYSSIS.Org>
- implement stubs for MsiSequence[AW].
Dmitry Timoshkov <dmitry@codeweavers.com>
- COLOR_3DFACE is a better choice for the dialog background.
- Fix the usage of COLOR_xxx constants in the place of the window's
  class hbrBackground.
Mike McCormack <mike@codeweavers.com>
- Stub implementation of the RemoveIniValues action.
- Fix various memory leaks.
- Simplify the ProcessComponents action a little.
- Make build_icon_path return the path directly.
- Implement MsiSequenceA/W.
- Simplify the InstallValidate action a little.
- Added memory allocation inline functions (part 2).
- Fix a bug in a previous patch spotted by Dieter Komendera.
- Convert progids to a standard list.
- convert verbs into a standard list
- remove limitation of 100 verbs
- use pointers to verbs rather than indexes
- Rename load_dynamic_property and remove its unused 3rd argument.
- Create a macro to write a value to a subkey.
- Use the new msi_reg_set* macros where possible.
- Create a macro function to write registry values.
- fix a bug introduced by the progid list conversion
- make a fixme a little less alarmist
- Add objects to lists at the right time.
- Fix some simple memory leaks.
- Fix an error introduced when converting dialog lists to standard
  lists.
- Added memory allocation inline functions (part 1).
- Make sure not to free a a pointer that has been modified.
  Check that the text identifier doesn't contain invalid characters.
- Don't quote numbers in a query, as it doesn't parse correctly.
- Read the MaskEdit template from the correct db field.
- Don't create MSI handles unless we have to pass one through the API.
- Convert the list of dialog controls to a standard list.
- Deformat all dialog text strings before using them.
- Load riched20.dll on demand, and unload it after it's used (based on a
  patch by Rob Shearman).
- Make sure to release the package we grabbed on the error path.
- Fix and test MsiViewGetColumnInfo and binary fields.
- Skip dash characters in the PIDMask for a MaskedEdit control.
- Don't refcount tables.
- Fix an uninitialized variable problem.
- Fix memory leaks in the table code.
- Fix memory leaks.
- Remove some unused values in the object header.
- Fill out the stubs for MsiApplyTransformA/W a bit more.
- Fix various query related memory leaks.
- Make sure to set the minimum size before allocating string table
  memory.
- Don't include the terminating nul in the length in
  MsiSummaryInfoGetPropertyW.
- fix MsiSummaryInfoGetProperty to return ERROR_MORE_DATA if the
  buffer is too small (based on a patch by Aric Stewart)
- add a test case to show correct behaviour
- Create a function to determine the table's row size and use it.
  Fix a memory leak in the table code.
- Eliminate fixed length buffers from the MSIFEATURE structure.
- Fix more fixed length buffers.
- Reduce the indent level of a function.
- Allocate memory rather than using fixed length buffers.
- Remove an unnecessary level of indent.
- Keep temporary files in a seperate list.
- Rename ACTION_DoTopLevelINSTALL to MSI_InstallPackage, remove its
  duplicate 4th parameter.
  Split the code to copy a package into a separate function.
- Avoid fixed length buffers for conditions.
- Fix a memory leak.
- Create a function to read a property as an integer.
- Make some fixme messages less alarmist.
- Fix if's that are followed by semicolons.
- Add some more action stubs, remove forward declarations.
- Eliminate yet more fixed length buffers.
- Convert RunningActions array into a list.
- Split command line parsing from MSI_InstallPackage into a separate
  function.
- Move a fixed size buffer to the heap.
- Fix memory leaks in custom actions.
- Make a macro function for unimplemented actions.
  Add some more unimplemented action stubs.
- Make load_string_table return the string table.
- Stub implementation of the IsolateComponents action.
- Convert the list of tables to a standard list.
- Add a stub implementation of the BindImage action.
- Avoid UpdateWindow, it causes trouble with WS_EX_TRANSPARENT.
- Stub implementation of the PatchFiles action.
- Fix another memory leak.
- Add the progress control.
- Stub implementation of the MoveFiles action.
- Avoid using static variables in the InstallFiles action.
- Take advantage of the msi_get_deformatted_field function to simplify
  some code.
- Improve a fixme message a little.
- Skip the first character of a font identifier if it's \ or &.
- Make sure not to access invalid components or features.
- Fix the handling of MsiGetTargetPath args (with test case).
- Fix the handling of MsiDoAction args (with test case).
- Fixes for MsiGetSourcePath parameter handling.
- Load a table's column information separately from the table itself.
- Handle copying of the install package to a temporary file in one place
  only.
- Implement MsiGetShortcutTargetA.
- Fix the stub for MsiConfigureFeature.
Alexander N. Sørnes <alex@thehandofagony.com>
- Added Norwegian translations.
Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
- Added Finnish resources.

svn path=/trunk/; revision=18333
This commit is contained in:
Gé van Geldorp 2005-10-08 13:45:19 +00:00
parent ab288dfff4
commit 20cd7beedc
48 changed files with 7452 additions and 6323 deletions

File diff suppressed because it is too large Load diff

View file

@ -23,18 +23,16 @@
#include "wine/list.h"
#define IDENTIFIER_SIZE 96
typedef struct tagMSIFEATURE
{
struct list entry;
WCHAR Feature[IDENTIFIER_SIZE];
WCHAR Feature_Parent[IDENTIFIER_SIZE];
WCHAR Title[0x100];
WCHAR Description[0x100];
LPWSTR Feature;
LPWSTR Feature_Parent;
LPWSTR Title;
LPWSTR Description;
INT Display;
INT Level;
WCHAR Directory[IDENTIFIER_SIZE];
LPWSTR Directory;
INT Attributes;
INSTALLSTATE Installed;
@ -50,12 +48,12 @@ typedef struct tagMSICOMPONENT
{
struct list entry;
DWORD magic;
WCHAR Component[IDENTIFIER_SIZE];
WCHAR ComponentId[IDENTIFIER_SIZE];
WCHAR Directory[IDENTIFIER_SIZE];
LPWSTR Component;
LPWSTR ComponentId;
LPWSTR Directory;
INT Attributes;
WCHAR Condition[0x100];
WCHAR KeyPath[IDENTIFIER_SIZE];
LPWSTR Condition;
LPWSTR KeyPath;
INSTALLSTATE Installed;
INSTALLSTATE ActionRequest;
@ -114,15 +112,22 @@ typedef struct tagMSIFILE
/* 2 = present but replace */
/* 3 = present do not replace */
/* 4 = Installed */
/* 5 = Skipped */
LPWSTR SourcePath;
LPWSTR TargetPath;
BOOL Temporary;
} MSIFILE;
typedef struct tagMSITEMPFILE
{
struct list entry;
LPWSTR File;
LPWSTR Path;
} MSITEMPFILE;
typedef struct tagMSIAPPID
{
struct list entry;
WCHAR AppID[IDENTIFIER_SIZE]; /* Primary key */
LPWSTR AppID; /* Primary key */
LPWSTR RemoteServerName;
LPWSTR LocalServer;
LPWSTR ServiceParameters;
@ -131,13 +136,15 @@ typedef struct tagMSIAPPID
BOOL RunAsInteractiveUser;
} MSIAPPID;
typedef struct tagMSIPROGID MSIPROGID;
typedef struct tagMSICLASS
{
struct list entry;
WCHAR CLSID[IDENTIFIER_SIZE]; /* Primary Key */
WCHAR Context[IDENTIFIER_SIZE]; /* Primary Key */
LPWSTR clsid; /* Primary Key */
LPWSTR Context; /* Primary Key */
MSICOMPONENT *Component;
INT ProgIDIndex;
MSIPROGID *ProgID;
LPWSTR ProgIDText;
LPWSTR Description;
MSIAPPID *AppID;
@ -157,34 +164,34 @@ typedef struct tagMSIMIME MSIMIME;
typedef struct tagMSIEXTENSION
{
struct list entry;
WCHAR Extension[256]; /* Primary Key */
LPWSTR Extension; /* Primary Key */
MSICOMPONENT *Component;
INT ProgIDIndex;
MSIPROGID *ProgID;
LPWSTR ProgIDText;
MSIMIME *Mime;
MSIFEATURE *Feature;
/* not in the table, set during installation */
BOOL Installed;
INT VerbCount;
INT Verbs[100]; /* yes hard coded limit, but realistically 100 verbs??? */
struct list verbs;
} MSIEXTENSION;
typedef struct tagMSIPROGID
struct tagMSIPROGID
{
struct list entry;
LPWSTR ProgID; /* Primary Key */
INT ParentIndex;
MSIPROGID *Parent;
MSICLASS *Class;
LPWSTR Description;
LPWSTR IconPath;
/* not in the table, set during installation */
BOOL InstallMe;
INT CurVerIndex;
INT VersionIndIndex;
} MSIPROGID;
MSIPROGID *CurVer;
MSIPROGID *VersionInd;
};
typedef struct tagMSIVERB
{
MSIEXTENSION *Extension;
struct list entry;
LPWSTR Verb;
INT Sequence;
LPWSTR Command;
@ -196,7 +203,7 @@ struct tagMSIMIME
struct list entry;
LPWSTR ContentType; /* Primary Key */
MSIEXTENSION *Extension;
WCHAR CLSID[IDENTIFIER_SIZE];
LPWSTR clsid;
MSICLASS *Class;
/* not in the table, set during installation */
BOOL InstallMe;
@ -244,7 +251,7 @@ extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
/* Helpers */
extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
extern WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
extern LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
extern LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop);
extern LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
BOOL set_prop, MSIFOLDER **folder);
extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
@ -253,7 +260,7 @@ extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
extern int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
extern UINT build_icon_path(MSIPACKAGE *, LPCWSTR, LPWSTR *);
extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
extern DWORD build_version_dword(LPCWSTR);
extern LPWSTR build_directory_name(DWORD , ...);
extern BOOL create_full_pathW(const WCHAR *path);

View file

@ -124,14 +124,14 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
{
ACTION_VerStrToInteger(minVersion, &sig->MinVersionMS,
&sig->MinVersionLS);
HeapFree(GetProcessHeap(), 0, minVersion);
msi_free( minVersion);
}
maxVersion = load_dynamic_stringW(row,4);
if (maxVersion)
{
ACTION_VerStrToInteger(maxVersion, &sig->MaxVersionMS,
&sig->MaxVersionLS);
HeapFree(GetProcessHeap(), 0, maxVersion);
msi_free( maxVersion);
}
sig->MinSize = MSI_RecordGetInteger(row,5);
if (sig->MinSize == MSI_NULL_INTEGER)
@ -325,7 +325,7 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
/* FIXME: sanity-check sz before allocating (is there an upper-limit
* on the value of a property?)
*/
value = HeapAlloc(GetProcessHeap(), 0, sz);
value = msi_alloc( sz);
rc = RegQueryValueExW(key, valueName, NULL, &regType, value, &sz);
if (rc)
{
@ -347,14 +347,13 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
if (*(LPWSTR)value == '#')
{
/* escape leading pound with another */
propertyValue = HeapAlloc(GetProcessHeap(), 0,
sz + sizeof(WCHAR));
propertyValue = msi_alloc( sz + sizeof(WCHAR));
propertyValue[0] = '#';
strcpyW(propertyValue + 1, (LPWSTR)value);
}
else
{
propertyValue = HeapAlloc(GetProcessHeap(), 0, sz);
propertyValue = msi_alloc( sz);
strcpyW(propertyValue, (LPWSTR)value);
}
break;
@ -362,20 +361,17 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
/* 7 chars for digits, 1 for NULL, 1 for #, and 1 for sign
* char if needed
*/
propertyValue = HeapAlloc(GetProcessHeap(), 0,
10 * sizeof(WCHAR));
propertyValue = msi_alloc( 10 * sizeof(WCHAR));
sprintfW(propertyValue, dwordFmt, *(DWORD *)value);
break;
case REG_EXPAND_SZ:
/* space for extra #% characters in front */
propertyValue = HeapAlloc(GetProcessHeap(), 0,
sz + 2 * sizeof(WCHAR));
propertyValue = msi_alloc( sz + 2 * sizeof(WCHAR));
sprintfW(propertyValue, expandSzFmt, (LPWSTR)value);
break;
case REG_BINARY:
/* 3 == length of "#x<nibble>" */
propertyValue = HeapAlloc(GetProcessHeap(), 0,
(sz * 3 + 1) * sizeof(WCHAR));
propertyValue = msi_alloc( (sz * 3 + 1) * sizeof(WCHAR));
for (i = 0; i < sz; i++)
sprintfW(propertyValue + i * 3, binFmt, value[i]);
break;
@ -390,12 +386,12 @@ static UINT ACTION_AppSearchReg(MSIPACKAGE *package, BOOL *appFound,
*appFound = TRUE;
end:
HeapFree(GetProcessHeap(), 0, propertyValue);
HeapFree(GetProcessHeap(), 0, value);
msi_free( propertyValue);
msi_free( value);
RegCloseKey(key);
HeapFree(GetProcessHeap(), 0, keyPath);
HeapFree(GetProcessHeap(), 0, valueName);
msi_free( keyPath);
msi_free( valueName);
msiobj_release(&row->hdr);
MSI_ViewClose(view);
@ -449,7 +445,7 @@ static UINT ACTION_AppSearchIni(MSIPACKAGE *package, BOOL *appFound,
fileName = load_dynamic_stringW(row,2);
FIXME("AppSearch unimplemented for IniLocator (ini file name %s)\n",
debugstr_w(fileName));
HeapFree(GetProcessHeap(), 0, fileName);
msi_free( fileName);
end:
msiobj_release(&row->hdr);
@ -549,7 +545,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath,
if (size)
{
LPVOID buf = HeapAlloc(GetProcessHeap(), 0, size);
LPVOID buf = msi_alloc( size);
if (buf)
{
@ -592,7 +588,7 @@ static UINT ACTION_FileVersionMatches(MSISIGNATURE *sig, LPCWSTR filePath,
else
*matches = TRUE;
}
HeapFree(GetProcessHeap(), 0, buf);
msi_free( buf);
}
else
rc = ERROR_OUTOFMEMORY;
@ -671,8 +667,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound,
* here. Add two because we might need to add a backslash if the dir name
* isn't backslash-terminated.
*/
buf = HeapAlloc(GetProcessHeap(), 0,
(dirLen + max(fileLen, lstrlenW(starDotStarW)) + 2) * sizeof(WCHAR));
buf = msi_alloc( (dirLen + max(fileLen, lstrlenW(starDotStarW)) + 2) * sizeof(WCHAR));
if (buf)
{
/* a depth of 0 implies we should search dir, so go ahead and search */
@ -726,7 +721,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, BOOL *appFound,
FindClose(hFind);
}
}
HeapFree(GetProcessHeap(), 0, buf);
msi_free(buf);
}
else
rc = ERROR_OUTOFMEMORY;
@ -965,8 +960,8 @@ UINT ACTION_AppSearch(MSIPACKAGE *package)
}
}
}
HeapFree(GetProcessHeap(), 0, sig.File);
HeapFree(GetProcessHeap(), 0, sig.Languages);
msi_free( sig.File);
msi_free( sig.Languages);
msiobj_release(&row->hdr);
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,83 @@
#ifndef BISON_COND_TAB_H
# define BISON_COND_TAB_H
/* A Bison parser, made by GNU Bison 1.875c. */
#ifndef YYSTYPE
typedef union
{
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
COND_SPACE = 258,
COND_EOF = 259,
COND_OR = 260,
COND_AND = 261,
COND_NOT = 262,
COND_LT = 263,
COND_GT = 264,
COND_EQ = 265,
COND_LPAR = 266,
COND_RPAR = 267,
COND_TILDA = 268,
COND_PERCENT = 269,
COND_DOLLARS = 270,
COND_QUESTION = 271,
COND_AMPER = 272,
COND_EXCLAM = 273,
COND_IDENT = 274,
COND_NUMBER = 275,
COND_LITER = 276,
COND_ERROR = 277
};
#endif
#define COND_SPACE 258
#define COND_EOF 259
#define COND_OR 260
#define COND_AND 261
#define COND_NOT 262
#define COND_LT 263
#define COND_GT 264
#define COND_EQ 265
#define COND_LPAR 266
#define COND_RPAR 267
#define COND_TILDA 268
#define COND_PERCENT 269
#define COND_DOLLARS 270
#define COND_QUESTION 271
#define COND_AMPER 272
#define COND_EXCLAM 273
#define COND_IDENT 274
#define COND_NUMBER 275
#define COND_LITER 276
#define COND_ERROR 277
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 106 "./cond.y"
typedef union YYSTYPE {
struct cond_str str;
LPWSTR string;
INT value;
@ -11,30 +85,15 @@ typedef union
comp_str fn_comp_str;
comp_m1 fn_comp_m1;
comp_m2 fn_comp_m2;
} yystype;
# define YYSTYPE yystype
} YYSTYPE;
/* Line 1275 of yacc.c. */
#line 91 "cond.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
# define COND_SPACE 257
# define COND_EOF 258
# define COND_OR 259
# define COND_AND 260
# define COND_NOT 261
# define COND_LT 262
# define COND_GT 263
# define COND_EQ 264
# define COND_LPAR 265
# define COND_RPAR 266
# define COND_TILDA 267
# define COND_PERCENT 268
# define COND_DOLLARS 269
# define COND_QUESTION 270
# define COND_AMPER 271
# define COND_EXCLAM 272
# define COND_IDENT 273
# define COND_NUMBER 274
# define COND_LITER 275
# define COND_ERROR 276
#endif /* not BISON_COND_TAB_H */

File diff suppressed because it is too large Load diff

View file

@ -64,7 +64,7 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
static const WCHAR szTables[] = { '_','T','a','b','l','e','s',0 };
static const WCHAR szColumns[] = { '_','C','o','l','u','m','n','s',0 };
MSIVIEW *tv = NULL;
MSIRECORD *rec;
MSIRECORD *rec = NULL;
TRACE("%p Table %s (%s)\n", cv, debugstr_w(cv->name),
cv->bIsTemp?"temporary":"permanent");
@ -148,6 +148,8 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
r = ERROR_SUCCESS;
err:
if (rec)
msiobj_release( &rec->hdr );
/* FIXME: remove values from the string table on error */
if( tv )
tv->ops->delete( tv );
@ -199,7 +201,7 @@ static UINT CREATE_delete( struct tagMSIVIEW *view )
TRACE("%p\n", cv );
msiobj_release( &cv->db->hdr );
HeapFree( GetProcessHeap(), 0, cv );
msi_free( cv );
return ERROR_SUCCESS;
}
@ -226,7 +228,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
TRACE("%p\n", cv );
cv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *cv );
cv = msi_alloc_zero( sizeof *cv );
if( !cv )
return ERROR_FUNCTION_FAILED;

View file

@ -57,6 +57,7 @@ static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
typedef struct tagMSIRUNNINGACTION
{
struct list entry;
HANDLE handle;
BOOL process;
LPWSTR name;
@ -153,10 +154,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
{
FIXME("Rollback only action... rollbacks not supported yet\n");
schedule_action(package, ROLLBACK_SCRIPT, action);
HeapFree(GetProcessHeap(),0,source);
HeapFree(GetProcessHeap(),0,target);
msiobj_release(&row->hdr);
return ERROR_SUCCESS;
rc = ERROR_SUCCESS;
goto end;
}
if (!execute)
{
@ -171,10 +170,8 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
schedule_action(package, INSTALL_SCRIPT, action);
}
HeapFree(GetProcessHeap(),0,source);
HeapFree(GetProcessHeap(),0,target);
msiobj_release(&row->hdr);
return ERROR_SUCCESS;
rc = ERROR_SUCCESS;
goto end;
}
else
{
@ -183,15 +180,19 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
static const WCHAR szActionData[] = {
'C','u','s','t','o','m','A','c','t','i','o','n','D','a','t','a',0};
static const WCHAR szBlank[] = {0};
LPWSTR actiondata = load_dynamic_property(package,action,NULL);
LPWSTR actiondata = msi_dup_property( package, action );
if (actiondata)
MSI_SetPropertyW(package,szActionData,actiondata);
else
MSI_SetPropertyW(package,szActionData,szBlank);
msi_free(actiondata);
}
}
else if (!check_execution_scheduling_options(package,action,type))
return ERROR_SUCCESS;
{
rc = ERROR_SUCCESS;
goto end;
}
switch (type & CUSTOM_ACTION_TYPE_MASK)
{
@ -216,12 +217,12 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
case 35: /* Directory set with formatted text. */
deformat_string(package,target,&deformated);
MSI_SetTargetPathW(package, source, deformated);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(deformated);
break;
case 51: /* Property set with formatted text. */
deformat_string(package,target,&deformated);
rc = MSI_SetPropertyW(package,source,deformated);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(deformated);
break;
default:
FIXME("UNHANDLED ACTION TYPE %i (%s %s)\n",
@ -229,8 +230,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
debugstr_w(target));
}
HeapFree(GetProcessHeap(),0,source);
HeapFree(GetProcessHeap(),0,target);
end:
msi_free(source);
msi_free(target);
msiobj_release(&row->hdr);
return rc;
}
@ -243,8 +245,7 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
static const WCHAR f1[] = {'m','s','i',0};
WCHAR fmt[MAX_PATH];
if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz)
!= ERROR_SUCCESS)
if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) != ERROR_SUCCESS)
GetTempPathW(MAX_PATH,fmt);
if (GetTempFileNameW(fmt,f1,0,tmp_file) == 0)
@ -300,22 +301,15 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
BOOL process, LPCWSTR name)
{
MSIRUNNINGACTION *newbuf = NULL;
INT count;
count = package->RunningActionCount;
package->RunningActionCount++;
if (count != 0)
newbuf = HeapReAlloc(GetProcessHeap(),0,
package->RunningAction,
package->RunningActionCount * sizeof(MSIRUNNINGACTION));
else
newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(MSIRUNNINGACTION));
MSIRUNNINGACTION *action;
newbuf[count].handle = Handle;
newbuf[count].process = process;
newbuf[count].name = strdupW(name);
action = msi_alloc( sizeof(MSIRUNNINGACTION) );
package->RunningAction = newbuf;
action->handle = Handle;
action->process = process;
action->name = strdupW(name);
list_add_tail( &package->RunningActions, &action->entry );
}
static UINT process_action_return_value(UINT type, HANDLE ThreadHandle)
@ -373,7 +367,7 @@ static UINT process_handle(MSIPACKAGE* package, UINT type,
}
CloseHandle(ThreadHandle);
if (ProcessHandle);
if (ProcessHandle)
CloseHandle(ProcessHandle);
if (finished)
*finished = TRUE;
@ -395,7 +389,7 @@ static UINT process_handle(MSIPACKAGE* package, UINT type,
else
{
CloseHandle(ThreadHandle);
if (ProcessHandle);
if (ProcessHandle)
CloseHandle(ProcessHandle);
}
if (finished)
@ -436,11 +430,11 @@ static DWORD WINAPI ACTION_CallDllFunction(thread_struct *stuff)
MSIPACKAGE *package = stuff->package;
TRACE("Calling function %s\n", proc);
hPackage = msiobj_findhandle( &package->hdr );
if (hPackage )
hPackage = alloc_msihandle( &package->hdr );
if (hPackage)
{
rc = fn(hPackage);
msiobj_release( &package->hdr );
rc = fn( hPackage );
MsiCloseHandle( hPackage );
}
else
ERR("Handle for object %p not found\n", package );
@ -448,15 +442,15 @@ static DWORD WINAPI ACTION_CallDllFunction(thread_struct *stuff)
else
ERR("Cannot load functon\n");
HeapFree(GetProcessHeap(),0,proc);
msi_free(proc);
FreeLibrary(hModule);
}
else
ERR("Unable to load library\n");
msiobj_release( &stuff->package->hdr );
HeapFree(GetProcessHeap(),0,stuff->source);
HeapFree(GetProcessHeap(),0,stuff->target);
HeapFree(GetProcessHeap(), 0, stuff);
msi_free(stuff->source);
msi_free(stuff->target);
msi_free(stuff);
return rc;
}
@ -498,7 +492,7 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
strcatW(tmp_file,dot);
}
info = HeapAlloc( GetProcessHeap(), 0, sizeof(*info) );
info = msi_alloc( sizeof(*info) );
msiobj_addref( &package->hdr );
info->package = package;
info->target = strdupW(target);
@ -541,7 +535,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
if (deformated)
len += strlenW(deformated);
cmd = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len);
cmd = msi_alloc(sizeof(WCHAR)*len);
strcpyW(cmd,tmp_file);
if (deformated)
@ -549,7 +543,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
strcatW(cmd,spc);
strcatW(cmd,deformated);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(deformated);
}
TRACE("executing exe %s \n",debugstr_w(cmd));
@ -557,7 +551,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,cmd);
msi_free(cmd);
if ( !rc )
{
@ -602,7 +596,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
len += strlenW(deformated);
len += 2;
cmd = HeapAlloc(GetProcessHeap(),0,len * sizeof(WCHAR));
cmd = msi_alloc(len * sizeof(WCHAR));
lstrcpyW( cmd, file->TargetPath);
if (deformated)
@ -610,7 +604,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
strcatW(cmd, spc);
strcatW(cmd, deformated);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(deformated);
}
TRACE("executing exe %s \n",debugstr_w(cmd));
@ -618,7 +612,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,cmd);
msi_free(cmd);
if ( !rc )
{
@ -639,7 +633,7 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
'S','E','L','E','C','T',' ','`','M','e','s','s','a','g','e','`',' ',
'F','R','O','M',' ','`','E','r','r','o','r','`',' ',
'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ',
'\'','%','s','\'',0
'%','s',0
};
MSIRECORD *row = 0;
LPWSTR deformated = NULL;
@ -657,7 +651,7 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
else
MessageBoxW( NULL, deformated, NULL, MB_OK );
HeapFree( GetProcessHeap(), 0, deformated );
msi_free( deformated );
return ERROR_FUNCTION_FAILED;
}
@ -672,13 +666,12 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
WCHAR *deformated;
WCHAR *cmd;
INT len;
UINT prc;
static const WCHAR spc[] = {' ',0};
memset(&si,0,sizeof(STARTUPINFOW));
memset(&info,0,sizeof(PROCESS_INFORMATION));
prop = load_dynamic_property(package,source,&prc);
prop = msi_dup_property( package, source );
if (!prop)
return ERROR_SUCCESS;
@ -687,7 +680,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
if (deformated)
len += strlenW(deformated);
cmd = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*len);
cmd = msi_alloc(sizeof(WCHAR)*len);
strcpyW(cmd,prop);
if (deformated)
@ -695,15 +688,16 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
strcatW(cmd,spc);
strcatW(cmd,deformated);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(deformated);
}
msi_free(prop);
TRACE("executing exe %s \n",debugstr_w(cmd));
rc = CreateProcessW(NULL, cmd, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,cmd);
msi_free(cmd);
if ( !rc )
{
@ -711,10 +705,7 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source,
return ERROR_SUCCESS;
}
prc = process_handle(package, type, info.hThread, info.hProcess, action,
NULL);
return prc;
return process_handle(package, type, info.hThread, info.hProcess, action, NULL);
}
static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
@ -734,7 +725,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
return ERROR_FUNCTION_FAILED;
SetCurrentDirectoryW(filename);
HeapFree(GetProcessHeap(),0,filename);
msi_free(filename);
deformat_string(package,target,&deformated);
@ -745,7 +736,7 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
rc = CreateProcessW(NULL, deformated, NULL, NULL, FALSE, 0, NULL,
c_collen, &si, &info);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(deformated);
if ( !rc )
{
@ -762,29 +753,30 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
void ACTION_FinishCustomActions(MSIPACKAGE* package)
{
INT i;
struct list *item, *cursor;
DWORD rc;
for (i = 0; i < package->RunningActionCount; i++)
LIST_FOR_EACH_SAFE( item, cursor, &package->RunningActions )
{
TRACE("Checking on action %s\n",
debugstr_w(package->RunningAction[i].name));
MSIRUNNINGACTION *action = LIST_ENTRY( item, MSIRUNNINGACTION, entry );
if (package->RunningAction[i].process)
GetExitCodeProcess(package->RunningAction[i].handle, &rc);
TRACE("Checking on action %s\n", debugstr_w(action->name));
list_remove( &action->entry );
if (action->process)
GetExitCodeProcess( action->handle, &rc );
else
GetExitCodeThread(package->RunningAction[i].handle, &rc);
GetExitCodeThread( action->handle, &rc );
if (rc == STILL_ACTIVE)
{
TRACE("Waiting on action %s\n",
debugstr_w(package->RunningAction[i].name));
msi_dialog_check_messages(package->RunningAction[i].handle);
TRACE("Waiting on action %s\n", debugstr_w( action->name) );
msi_dialog_check_messages( action->handle );
}
HeapFree(GetProcessHeap(),0,package->RunningAction[i].name);
CloseHandle(package->RunningAction[i].handle);
CloseHandle( action->handle );
msi_free( action->name );
msi_free( action );
}
HeapFree(GetProcessHeap(),0,package->RunningAction);
}

View file

@ -48,6 +48,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
DEFINE_GUID( CLSID_MsiDatabase, 0x000c1084, 0x0000, 0x0000,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
DEFINE_GUID( CLSID_MsiPatch, 0x000c1086, 0x0000, 0x0000,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
/*
* .MSI file format
@ -91,7 +93,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
/* UINT len = lstrlenW( szPerist ) + 1; */
FIXME("don't support persist files yet\b");
return ERROR_INVALID_PARAMETER;
/* szMode = HeapAlloc( GetProcessHeap(), 0, len * sizeof (DWORD) ); */
/* szMode = msi_alloc( len * sizeof (DWORD) ); */
}
else if( szPersist == MSIDBOPEN_READONLY )
{
@ -132,14 +134,14 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
goto end;
}
if( memcmp( &stat.clsid, &CLSID_MsiDatabase, sizeof (GUID) ) )
if ( !IsEqualGUID( &stat.clsid, &CLSID_MsiDatabase ) &&
!IsEqualGUID( &stat.clsid, &CLSID_MsiPatch ) )
{
ERR("storage GUID is not a MSI database GUID %s\n",
debugstr_guid(&stat.clsid) );
goto end;
}
db = alloc_msiobject( MSIHANDLETYPE_DATABASE, sizeof (MSIDATABASE),
MSI_CloseDatabase );
if( !db )
@ -153,11 +155,14 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
db->storage = stg;
db->mode = szMode;
list_init( &db->tables );
ret = load_string_table( db );
if( ret != ERROR_SUCCESS )
db->strings = load_string_table( stg );
if( !db->strings )
goto end;
ret = ERROR_SUCCESS;
msiobj_addref( &db->hdr );
IStorage_AddRef( stg );
*pdb = db;
@ -215,8 +220,8 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
end:
if( HIWORD(szPersist) )
HeapFree( GetProcessHeap(), 0, szwPersist );
HeapFree( GetProcessHeap(), 0, szwDBPath );
msi_free( szwPersist );
msi_free( szwDBPath );
return r;
}
@ -271,8 +276,8 @@ UINT WINAPI MsiDatabaseImportA( MSIHANDLE handle,
r = MsiDatabaseImportW( handle, path, file );
end:
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, file );
msi_free( path );
msi_free( file );
return r;
}
@ -339,9 +344,9 @@ UINT WINAPI MsiDatabaseExportA( MSIHANDLE handle, LPCSTR szTable,
r = MsiDatabaseExportW( handle, table, path, file );
end:
HeapFree( GetProcessHeap(), 0, table );
HeapFree( GetProcessHeap(), 0, path );
HeapFree( GetProcessHeap(), 0, file );
msi_free( table );
msi_free( path );
msi_free( file );
return r;
}

View file

@ -177,7 +177,7 @@ static UINT DELETE_delete( struct tagMSIVIEW *view )
if( dv->table )
dv->table->ops->delete( dv->table );
HeapFree( GetProcessHeap(), 0, dv );
msi_free( dv );
return ERROR_SUCCESS;
}
@ -203,7 +203,7 @@ UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table )
TRACE("%p\n", dv );
dv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *dv );
dv = msi_alloc_zero( sizeof *dv );
if( !dv )
return ERROR_FUNCTION_FAILED;

View file

@ -33,6 +33,7 @@
#include "ocidl.h"
#include "olectl.h"
#include "richedit.h"
#include "commctrl.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@ -48,7 +49,7 @@ typedef UINT (*msi_handler)( msi_dialog *, msi_control *, WPARAM );
struct msi_control_tag
{
struct msi_control_tag *next;
struct list entry;
HWND hwnd;
msi_handler handler;
LPWSTR property;
@ -56,6 +57,7 @@ struct msi_control_tag
HBITMAP hBitmap;
HICON hIcon;
LPWSTR tabnext;
HMODULE hDll;
WCHAR name[1];
};
@ -76,7 +78,7 @@ struct msi_dialog_tag
HWND hwnd;
LPWSTR default_font;
msi_font *font_list;
msi_control *control_list;
struct list controls;
HWND hWndFocus;
WCHAR name[1];
};
@ -114,6 +116,8 @@ static const WCHAR szComboBox[] = { 'C','o','m','b','o','B','o','x',0 };
static const WCHAR szEdit[] = { 'E','d','i','t',0 };
static const WCHAR szMaskedEdit[] = { 'M','a','s','k','e','d','E','d','i','t',0 };
static const WCHAR szPathEdit[] = { 'P','a','t','h','E','d','i','t',0 };
static const WCHAR szProgressBar[] = {
'P','r','o','g','r','e','s','s','B','a','r',0 };
static const WCHAR szRadioButtonGroup[] = {
'R','a','d','i','o','B','u','t','t','o','n','G','r','o','u','p',0 };
static const WCHAR szIcon[] = { 'I','c','o','n',0 };
@ -134,7 +138,6 @@ static LRESULT WINAPI MSIRadioGroup_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
static DWORD uiThreadId;
static HWND hMsiHiddenWindow;
static HMODULE hRichedit;
static INT msi_dialog_scale_unit( msi_dialog *dialog, INT val )
{
@ -147,20 +150,30 @@ static msi_control *msi_dialog_find_control( msi_dialog *dialog, LPCWSTR name )
if( !name )
return NULL;
for( control = dialog->control_list; control; control = control->next )
LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry )
if( !strcmpW( control->name, name ) ) /* FIXME: case sensitive? */
break;
return control;
return control;
return NULL;
}
static msi_control *msi_dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hwnd )
{
msi_control *control;
for( control = dialog->control_list; control; control = control->next )
LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry )
if( hwnd == control->hwnd )
break;
return control;
return control;
return NULL;
}
static LPWSTR msi_get_deformatted_field( MSIPACKAGE *package, MSIRECORD *rec, int field )
{
LPCWSTR str = MSI_RecordGetString( rec, field );
LPWSTR ret = NULL;
if (str)
deformat_string( package, str, &ret );
return ret;
}
/*
@ -169,23 +182,32 @@ static msi_control *msi_dialog_find_control_by_hwnd( msi_dialog *dialog, HWND hw
* Extract the {\style} string from the front of the text to display and
* update the pointer.
*/
static LPWSTR msi_dialog_get_style( LPCWSTR *text )
static LPWSTR msi_dialog_get_style( LPCWSTR p, LPCWSTR *rest )
{
LPWSTR ret = NULL;
LPCWSTR p = *text, q;
LPCWSTR q, i;
DWORD len;
*rest = p;
if( !p )
return ret;
if( *p++ != '{' )
return ret;
q = strchrW( p, '}' );
if( !q )
return ret;
*text = ++q;
if( *p++ != '\\' )
return ret;
len = q - p;
if( *p == '\\' || *p == '&' )
p++;
/* little bit of sanity checking to stop us getting confused with RTF */
for( i=p; i<q; i++ )
if( *i == '}' || *i == '\\' )
return ret;
ret = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
*rest = ++q;
len = q - p;
ret = msi_alloc( len*sizeof(WCHAR) );
if( !ret )
return ret;
memcpy( ret, p, len*sizeof(WCHAR) );
@ -204,8 +226,7 @@ static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param )
/* create a font and add it to the list */
name = MSI_RecordGetString( rec, 1 );
font = HeapAlloc( GetProcessHeap(), 0,
sizeof *font + strlenW( name )*sizeof (WCHAR) );
font = msi_alloc( sizeof *font + strlenW( name )*sizeof (WCHAR) );
strcpyW( font->name, name );
font->next = dialog->font_list;
dialog->font_list = font;
@ -288,21 +309,21 @@ static msi_control *msi_dialog_create_window( msi_dialog *dialog,
DWORD style, HWND parent )
{
DWORD x, y, width, height;
LPWSTR font = NULL, title = NULL;
LPWSTR font = NULL, title_font = NULL;
LPCWSTR title = NULL;
msi_control *control;
style |= WS_CHILD;
control = HeapAlloc( GetProcessHeap(), 0,
sizeof *control + strlenW(name)*sizeof(WCHAR) );
control = msi_alloc( sizeof *control + strlenW(name)*sizeof(WCHAR) );
strcpyW( control->name, name );
control->next = dialog->control_list;
dialog->control_list = control;
list_add_head( &dialog->controls, &control->entry );
control->handler = NULL;
control->property = NULL;
control->value = NULL;
control->hBitmap = NULL;
control->hIcon = NULL;
control->hDll = NULL;
control->tabnext = strdupW( MSI_RecordGetString( rec, 11) );
x = MSI_RecordGetInteger( rec, 4 );
@ -317,8 +338,8 @@ static msi_control *msi_dialog_create_window( msi_dialog *dialog,
if( text )
{
font = msi_dialog_get_style( &text );
deformat_string( dialog->package, text, &title );
deformat_string( dialog->package, text, &title_font );
font = msi_dialog_get_style( title_font, &title );
}
control->hwnd = CreateWindowW( szCls, title, style,
@ -330,8 +351,8 @@ static msi_control *msi_dialog_create_window( msi_dialog *dialog,
msi_dialog_set_font( dialog, control->hwnd,
font ? font : dialog->default_font );
HeapFree( GetProcessHeap(), 0, font );
HeapFree( GetProcessHeap(), 0, title );
msi_free( title_font );
msi_free( font );
return control;
}
@ -359,13 +380,13 @@ static LPWSTR msi_create_tmp_path(void)
if( !r )
return path;
len = lstrlenW( tmp ) + 20;
path = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) );
path = msi_alloc( len * sizeof (WCHAR) );
if( path )
{
r = GetTempFileNameW( tmp, prefix, 0, path );
if (!r)
{
HeapFree( GetProcessHeap(), 0, path );
msi_free( path );
path = NULL;
}
}
@ -399,7 +420,7 @@ static HANDLE msi_load_image( MSIDATABASE *db, LPCWSTR name, UINT type,
msiobj_release( &rec->hdr );
}
HeapFree( GetProcessHeap(), 0, tmp );
msi_free( tmp );
return himage;
}
@ -438,7 +459,10 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
if (!ctrl)
return;
if( lstrcmpW(attribute, szText) )
{
ERR("Attribute %s\n", debugstr_w(attribute));
return;
}
text = MSI_RecordGetString( rec , 1 );
SetWindowTextW( ctrl->hwnd, text );
msi_dialog_check_messages( NULL );
@ -534,7 +558,7 @@ MSIText_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
msi_text_on_settext( hWnd );
break;
case WM_NCDESTROY:
HeapFree( GetProcessHeap(), 0, info );
msi_free( info );
RemovePropW( hWnd, szButtonData );
break;
}
@ -553,7 +577,7 @@ static UINT msi_dialog_text_control( msi_dialog *dialog, MSIRECORD *rec )
if( !control )
return ERROR_FUNCTION_FAILED;
info = HeapAlloc( GetProcessHeap(), 0, sizeof *info );
info = msi_alloc( sizeof *info );
if( !info )
return ERROR_SUCCESS;
@ -572,7 +596,7 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
{
msi_control *control;
UINT attributes, style;
LPCWSTR text;
LPWSTR text;
TRACE("%p %p\n", dialog, rec);
@ -588,10 +612,11 @@ static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec )
control->handler = msi_dialog_button_handler;
/* set the icon */
text = MSI_RecordGetString( rec, 10 );
text = msi_get_deformatted_field( dialog->package, rec, 10 );
control->hIcon = msi_load_icon( dialog->package->db, text, attributes );
if( attributes & msidbControlAttributesIcon )
SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon );
msi_free( text );
return ERROR_SUCCESS;
}
@ -606,7 +631,6 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop )
'\'','%','s','\'',0
};
MSIRECORD *rec = NULL;
LPCWSTR val = NULL;
LPWSTR ret = NULL;
/* find if there is a value associated with the checkbox */
@ -614,24 +638,20 @@ static LPWSTR msi_get_checkbox_value( msi_dialog *dialog, LPCWSTR prop )
if (!rec)
return ret;
val = MSI_RecordGetString( rec, 2 );
if (val)
ret = msi_get_deformatted_field( dialog->package, rec, 2 );
if( ret && !ret[0] )
{
deformat_string( dialog->package, val, &ret );
if( ret && !ret[0] )
{
HeapFree( GetProcessHeap(), 0, ret );
ret = NULL;
}
msi_free( ret );
ret = NULL;
}
msiobj_release( &rec->hdr );
if (ret)
return ret;
ret = load_dynamic_property(dialog->package, prop, NULL);
ret = msi_dup_property( dialog->package, prop );
if( ret && !ret[0] )
{
HeapFree( GetProcessHeap(), 0, ret );
msi_free( ret );
ret = NULL;
}
@ -702,10 +722,17 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
LPCWSTR text;
EDITSTREAM es;
DWORD style;
HMODULE hRichedit;
hRichedit = LoadLibraryA("riched20");
style = WS_BORDER | ES_MULTILINE | WS_VSCROLL |
ES_READONLY | ES_AUTOVSCROLL | WS_TABSTOP;
control = msi_dialog_add_control( dialog, rec, szRichEdit20W, style );
if (!control)
return ERROR_FUNCTION_FAILED;
control->hDll = hRichedit;
text = MSI_RecordGetString( rec, 10 );
info.string = strdupWtoA( text );
@ -718,7 +745,7 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
SendMessageW( control->hwnd, EM_STREAMIN, SF_RTF, (LPARAM) &es );
HeapFree( GetProcessHeap(), 0, info.string );
msi_free( info.string );
return ERROR_SUCCESS;
}
@ -727,7 +754,7 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
{
UINT cx, cy, flags, style, attributes;
msi_control *control;
LPCWSTR text;
LPWSTR text;
flags = LR_LOADFROMFILE;
style = SS_BITMAP | SS_LEFT | WS_GROUP;
@ -740,12 +767,12 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
}
control = msi_dialog_add_control( dialog, rec, szStatic, style );
text = MSI_RecordGetString( rec, 10 );
cx = MSI_RecordGetInteger( rec, 6 );
cy = MSI_RecordGetInteger( rec, 7 );
cx = msi_dialog_scale_unit( dialog, cx );
cy = msi_dialog_scale_unit( dialog, cy );
text = msi_get_deformatted_field( dialog->package, rec, 10 );
control->hBitmap = msi_load_image( dialog->package->db, text,
IMAGE_BITMAP, cx, cy, flags );
if( control->hBitmap )
@ -753,6 +780,8 @@ static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec )
IMAGE_BITMAP, (LPARAM) control->hBitmap );
else
ERR("Failed to load bitmap %s\n", debugstr_w(text));
msi_free( text );
return ERROR_SUCCESS;
}
@ -761,7 +790,7 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
{
msi_control *control;
DWORD attributes;
LPCWSTR text;
LPWSTR text;
TRACE("\n");
@ -769,12 +798,13 @@ static UINT msi_dialog_icon_control( msi_dialog *dialog, MSIRECORD *rec )
SS_ICON | SS_CENTERIMAGE | WS_GROUP );
attributes = MSI_RecordGetInteger( rec, 8 );
text = MSI_RecordGetString( rec, 10 );
text = msi_get_deformatted_field( dialog->package, rec, 10 );
control->hIcon = msi_load_icon( dialog->package->db, text, attributes );
if( control->hIcon )
SendMessageW( control->hwnd, STM_SETICON, (WPARAM) control->hIcon, 0 );
else
ERR("Failed to load bitmap %s\n", debugstr_w(text));
msi_free( text );
return ERROR_SUCCESS;
}
@ -799,9 +829,9 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec )
prop = MSI_RecordGetString( rec, 9 );
if( prop )
control->property = strdupW( prop );
val = load_dynamic_property( dialog->package, control->property, NULL );
val = msi_dup_property( dialog->package, control->property );
SetWindowTextW( control->hwnd, val );
HeapFree( GetProcessHeap(), 0, val );
msi_free( val );
return ERROR_SUCCESS;
}
@ -833,7 +863,7 @@ static void msi_mask_control_change( struct msi_maskedit_info *info )
LPWSTR val;
UINT i, n, r;
val = HeapAlloc( GetProcessHeap(), 0, (info->num_chars+1)*sizeof(WCHAR) );
val = msi_alloc( (info->num_chars+1)*sizeof(WCHAR) );
for( i=0, n=0; i<info->num_groups; i++ )
{
if( (info->group[i].len + n) > info->num_chars )
@ -857,7 +887,7 @@ static void msi_mask_control_change( struct msi_maskedit_info *info )
MSI_SetPropertyW( info->dialog->package, info->prop, val );
msi_dialog_evaluate_control_conditions( info->dialog );
}
HeapFree( GetProcessHeap(), 0, val );
msi_free( val );
}
/* now move to the next control if necessary */
@ -904,8 +934,8 @@ MSIMaskedEdit_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
case WM_NCDESTROY:
HeapFree( GetProcessHeap(), 0, info->prop );
HeapFree( GetProcessHeap(), 0, info );
msi_free( info->prop );
msi_free( info );
RemovePropW( hWnd, szButtonData );
break;
}
@ -928,7 +958,7 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text )
LPWSTR chunk = strdupW( p );
chunk[ info->group[i].len ] = 0;
SetWindowTextW( info->group[i].hwnd, chunk );
HeapFree( GetProcessHeap(), 0, chunk );
msi_free( chunk );
}
else
{
@ -954,13 +984,19 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask )
if( !p )
return info;
info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *info );
info = msi_alloc_zero( sizeof *info );
if( !info )
return info;
p++;
for( i=0; i<MASK_MAX_GROUPS; i++ )
{
while (*p=='-')
{
total++;
p++;
}
/* stop at the end of the string */
if( p[0] == 0 || p[0] == '>' )
break;
@ -980,7 +1016,7 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask )
p += n;
}
TRACE("%d characters in %d groups\n", total, info->num_groups );
TRACE("%d characters in %d groups\n", total, i );
if( i == MASK_MAX_GROUPS )
ERR("too many groups in PIDTemplate %s\n", debugstr_w(mask));
@ -991,10 +1027,9 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask )
}
static void
msi_maskedit_create_children( struct msi_maskedit_info *info )
msi_maskedit_create_children( struct msi_maskedit_info *info, LPCWSTR font )
{
DWORD width, height, style, wx, ww;
LPCWSTR text, font = NULL;
RECT rect;
HWND hwnd;
UINT i;
@ -1006,9 +1041,6 @@ msi_maskedit_create_children( struct msi_maskedit_info *info )
width = rect.right - rect.left;
height = rect.bottom - rect.top;
if( text )
font = msi_dialog_get_style( &text );
for( i = 0; i < info->num_groups; i++ )
{
wx = (info->group[i].ofs * width) / info->num_chars;
@ -1025,7 +1057,7 @@ msi_maskedit_create_children( struct msi_maskedit_info *info )
SendMessageW( hwnd, EM_LIMITTEXT, info->group[i].len, 0 );
msi_dialog_set_font( info->dialog, hwnd,
font ? font : info->dialog->default_font );
font?font:info->dialog->default_font );
info->group[i].hwnd = hwnd;
}
}
@ -1033,17 +1065,19 @@ msi_maskedit_create_children( struct msi_maskedit_info *info )
/* office 2003 uses "73931<````=````=````=````=`````>@@@@@" */
static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
{
const static WCHAR pidt[] = {'P','I','D','T','e','m','p','l','a','t','e',0};
LPWSTR mask = NULL, title = NULL, val = NULL;
LPWSTR font_mask, val = NULL, font;
struct msi_maskedit_info *info = NULL;
UINT ret = ERROR_SUCCESS;
msi_control *control;
LPCWSTR prop;
LPCWSTR prop, mask;
mask = load_dynamic_property( dialog->package, pidt, NULL );
TRACE("\n");
font_mask = msi_get_deformatted_field( dialog->package, rec, 10 );
font = msi_dialog_get_style( font_mask, &mask );
if( !mask )
{
ERR("PIDTemplate is empty\n");
ERR("mask template is empty\n");
goto end;
}
@ -1077,26 +1111,34 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
if( prop )
info->prop = strdupW( prop );
msi_maskedit_create_children( info );
msi_maskedit_create_children( info, font );
if( prop )
{
val = load_dynamic_property( dialog->package, prop, NULL );
val = msi_dup_property( dialog->package, prop );
if( val )
{
msi_maskedit_set_text( info, val );
HeapFree( GetProcessHeap(), 0, val );
msi_free( val );
}
}
end:
if( ret != ERROR_SUCCESS )
HeapFree( GetProcessHeap(), 0, info );
HeapFree( GetProcessHeap(), 0, title );
HeapFree( GetProcessHeap(), 0, mask );
msi_free( info );
msi_free( font_mask );
msi_free( font );
return ret;
}
/******************** Progress Bar *****************************************/
static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec )
{
msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, WS_VISIBLE );
return ERROR_SUCCESS;
}
/******************** Path Edit ********************************************/
static UINT msi_dialog_pathedit_control( msi_dialog *dialog, MSIRECORD *rec )
@ -1112,8 +1154,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param )
msi_dialog *dialog = group->dialog;
msi_control *control;
LPCWSTR prop, text, name;
DWORD style;
DWORD attributes = group->attributes;
DWORD style, attributes = group->attributes;
style = WS_CHILD | BS_AUTORADIOBUTTON | BS_MULTILINE | WS_TABSTOP;
name = MSI_RecordGetString( rec, 3 );
@ -1125,6 +1166,8 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param )
control = msi_dialog_create_window( dialog, rec, szButton, name, text,
style, group->parent->hwnd );
if (!control)
return ERROR_FUNCTION_FAILED;
control->handler = msi_dialog_radiogroup_handler;
prop = MSI_RecordGetString( rec, 1 );
@ -1197,6 +1240,7 @@ struct control_handler msi_dialog_handler[] =
{ szEdit, msi_dialog_edit_control },
{ szMaskedEdit, msi_dialog_maskedit_control },
{ szPathEdit, msi_dialog_pathedit_control },
{ szProgressBar, msi_dialog_progress_bar },
{ szRadioButtonGroup, msi_dialog_radiogroup_control },
{ szIcon, msi_dialog_icon_control },
};
@ -1394,7 +1438,7 @@ static UINT msi_dialog_set_tab_order( msi_dialog *dialog )
{
msi_control *control, *tab_next;
for( control = dialog->control_list; control; control = control->next )
LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry )
{
tab_next = msi_dialog_find_control( dialog, control->tabnext );
if( !tab_next )
@ -1422,7 +1466,6 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
'D','e','f','a','u','l','t','U','I','F','o','n','t',0 };
msi_dialog *dialog = (msi_dialog*) cs->lpCreateParams;
MSIRECORD *rec = NULL;
LPCWSTR text;
LPWSTR title = NULL;
SIZE size;
@ -1445,16 +1488,16 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
msi_dialog_adjust_dialog_size( dialog, &size );
dialog->attributes = MSI_RecordGetInteger( rec, 6 );
text = MSI_RecordGetString( rec, 7 );
dialog->default_font = load_dynamic_property( dialog->package, df, NULL );
dialog->default_font = msi_dup_property( dialog->package, df );
deformat_string( dialog->package, text, &title );
title = msi_get_deformatted_field( dialog->package, rec, 7 );
SetWindowTextW( hwnd, title );
msi_free( title );
SetWindowPos( hwnd, 0, 0, 0, size.cx, size.cy,
SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW );
HeapFree( GetProcessHeap(), 0, title );
msi_dialog_build_font_list( dialog );
msi_dialog_fill_controls( dialog );
@ -1477,8 +1520,8 @@ static UINT msi_dialog_send_event( msi_dialog *dialog, LPCWSTR event, LPCWSTR ar
dialog->event_handler( dialog->package, event_fmt, arg_fmt, dialog );
HeapFree( GetProcessHeap(), 0, event_fmt );
HeapFree( GetProcessHeap(), 0, arg_fmt );
msi_free( event_fmt );
msi_free( arg_fmt );
return ERROR_SUCCESS;
}
@ -1490,7 +1533,7 @@ static UINT msi_dialog_set_property( msi_dialog *dialog, LPCWSTR event, LPCWSTR
UINT len;
len = strlenW(event);
prop = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR));
prop = msi_alloc( len*sizeof(WCHAR));
strcpyW( prop, &event[1] );
p = strchrW( prop, ']' );
if( p && p[1] == 0 )
@ -1499,10 +1542,11 @@ static UINT msi_dialog_set_property( msi_dialog *dialog, LPCWSTR event, LPCWSTR
if( strcmpW( szNullArg, arg ) )
deformat_string( dialog->package, arg, &arg_fmt );
MSI_SetPropertyW( dialog->package, prop, arg_fmt );
msi_free( arg_fmt );
}
else
ERR("Badly formatted property string - what happens?\n");
HeapFree( GetProcessHeap(), 0, prop );
msi_free( prop );
return ERROR_SUCCESS;
}
@ -1633,19 +1677,19 @@ static UINT msi_dialog_edit_handler( msi_dialog *dialog,
debugstr_w(control->property));
sz = 0x20;
buf = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
buf = msi_alloc( sz*sizeof(WCHAR) );
while( buf )
{
r = GetWindowTextW( control->hwnd, buf, sz );
if( r < (sz-1) )
break;
sz *= 2;
buf = HeapReAlloc( GetProcessHeap(), 0, buf, sz*sizeof(WCHAR) );
sz *= 2;
buf = msi_realloc( buf, sz*sizeof(WCHAR) );
}
MSI_SetPropertyW( dialog->package, control->property, buf );
HeapFree( GetProcessHeap(), 0, buf );
msi_free( buf );
return ERROR_SUCCESS;
}
@ -1772,8 +1816,7 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
TRACE("%p %s\n", package, debugstr_w(szDialogName));
/* allocate the structure for the dialog to use */
dialog = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof *dialog + sizeof(WCHAR)*strlenW(szDialogName) );
dialog = msi_alloc_zero( sizeof *dialog + sizeof(WCHAR)*strlenW(szDialogName) );
if( !dialog )
return NULL;
strcpyW( dialog->name, szDialogName );
@ -1781,12 +1824,14 @@ msi_dialog *msi_dialog_create( MSIPACKAGE* package, LPCWSTR szDialogName,
dialog->package = package;
dialog->event_handler = event_handler;
dialog->finished = 0;
list_init( &dialog->controls );
/* verify that the dialog exists */
rec = msi_get_dialog_record( dialog );
if( !rec )
{
HeapFree( GetProcessHeap(), 0, dialog );
msiobj_release( &package->hdr );
msi_free( dialog );
return NULL;
}
dialog->attributes = MSI_RecordGetInteger( rec, 6 );
@ -1866,7 +1911,7 @@ UINT msi_dialog_run_message_loop( msi_dialog *dialog )
}
ShowWindow( hwnd, SW_SHOW );
UpdateWindow( hwnd );
/* UpdateWindow( hwnd ); - and causes the transparent static controls not to paint */
if( dialog->attributes & msidbDialogAttributesModal )
{
@ -1901,20 +1946,26 @@ void msi_dialog_destroy( msi_dialog *dialog )
if( dialog->hwnd )
ShowWindow( dialog->hwnd, SW_HIDE );
if( dialog->hwnd )
DestroyWindow( dialog->hwnd );
/* destroy the list of controls */
while( dialog->control_list )
while( !list_empty( &dialog->controls ) )
{
msi_control *t = dialog->control_list;
dialog->control_list = t->next;
msi_control *t = LIST_ENTRY( list_head( &dialog->controls ),
msi_control, entry );
list_remove( &t->entry );
/* leave dialog->hwnd - destroying parent destroys child windows */
HeapFree( GetProcessHeap(), 0, t->property );
HeapFree( GetProcessHeap(), 0, t->value );
msi_free( t->property );
msi_free( t->value );
if( t->hBitmap )
DeleteObject( t->hBitmap );
if( t->hIcon )
DestroyIcon( t->hIcon );
HeapFree( GetProcessHeap(), 0, t->tabnext );
HeapFree( GetProcessHeap(), 0, t );
msi_free( t->tabnext );
msi_free( t );
if (t->hDll)
FreeLibrary( t->hDll );
}
/* destroy the list of fonts */
@ -1923,16 +1974,13 @@ void msi_dialog_destroy( msi_dialog *dialog )
msi_font *t = dialog->font_list;
dialog->font_list = t->next;
DeleteObject( t->hfont );
HeapFree( GetProcessHeap(), 0, t );
msi_free( t );
}
HeapFree( GetProcessHeap(), 0, dialog->default_font );
if( dialog->hwnd )
DestroyWindow( dialog->hwnd );
msi_free( dialog->default_font );
msiobj_release( &dialog->package->hdr );
dialog->package = NULL;
HeapFree( GetProcessHeap(), 0, dialog );
msi_free( dialog );
}
BOOL msi_dialog_register_class( void )
@ -1944,7 +1992,7 @@ BOOL msi_dialog_register_class( void )
cls.hInstance = NULL;
cls.hIcon = LoadIconW(0, (LPWSTR)IDI_APPLICATION);
cls.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
cls.hbrBackground = (HBRUSH)(COLOR_WINDOW);
cls.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
cls.lpszMenuName = NULL;
cls.lpszClassName = szMsiDialogClass;
@ -1964,8 +2012,6 @@ BOOL msi_dialog_register_class( void )
if( !hMsiHiddenWindow )
return FALSE;
hRichedit = LoadLibraryA("riched20");
return TRUE;
}
@ -1974,5 +2020,4 @@ void msi_dialog_unregister_class( void )
DestroyWindow( hMsiHiddenWindow );
UnregisterClassW( szMsiDialogClass, NULL );
uiThreadId = 0;
FreeLibrary( hRichedit );
}

View file

@ -67,7 +67,7 @@ static DISTINCTSET ** distinct_insert( DISTINCTSET **x, UINT val, UINT row )
}
/* nothing found, so add one */
*x = HeapAlloc( GetProcessHeap(), 0, sizeof (DISTINCTSET) );
*x = msi_alloc( sizeof (DISTINCTSET) );
if( *x )
{
(*x)->val = val;
@ -85,7 +85,7 @@ static void distinct_free( DISTINCTSET *x )
{
DISTINCTSET *next = x->nextrow;
distinct_free( x->nextcol );
HeapFree( GetProcessHeap(), 0, x );
msi_free( x );
x = next;
}
}
@ -126,7 +126,7 @@ static UINT DISTINCT_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if( r != ERROR_SUCCESS )
return r;
dv->translation = HeapAlloc( GetProcessHeap(), 0, r_count*sizeof(UINT) );
dv->translation = msi_alloc( r_count*sizeof(UINT) );
if( !dv->translation )
return ERROR_FUNCTION_FAILED;
@ -178,7 +178,7 @@ static UINT DISTINCT_close( struct tagMSIVIEW *view )
if( !dv->table )
return ERROR_FUNCTION_FAILED;
HeapFree( GetProcessHeap(), 0, dv->translation );
msi_free( dv->translation );
dv->translation = NULL;
dv->row_count = 0;
@ -239,9 +239,9 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view )
if( dv->table )
dv->table->ops->delete( dv->table );
HeapFree( GetProcessHeap(), 0, dv->translation );
msi_free( dv->translation );
msiobj_release( &dv->db->hdr );
HeapFree( GetProcessHeap(), 0, dv );
msi_free( dv );
return ERROR_SUCCESS;
}
@ -275,7 +275,7 @@ UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table )
return r;
}
dv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *dv );
dv = msi_alloc_zero( sizeof *dv );
if( !dv )
return ERROR_FUNCTION_FAILED;

View file

@ -235,9 +235,12 @@ static UINT ControlEvent_AddSource(MSIPACKAGE* package, LPCWSTR argument,
static UINT ControlEvent_SetTargetPath(MSIPACKAGE* package, LPCWSTR argument,
msi_dialog* dialog)
{
LPWSTR path = load_dynamic_property(package,argument, NULL);
LPWSTR path = msi_dup_property( package, argument );
UINT r;
/* failure to set the path halts the executing of control events */
return MSI_SetTargetPathW(package, argument, path);
r = MSI_SetTargetPathW(package, argument, path);
msi_free(path);
return r;
}
/*
@ -245,10 +248,10 @@ static UINT ControlEvent_SetTargetPath(MSIPACKAGE* package, LPCWSTR argument,
*/
static void free_subscriber( struct subscriber *sub )
{
HeapFree(GetProcessHeap(),0,sub->event);
HeapFree(GetProcessHeap(),0,sub->control);
HeapFree(GetProcessHeap(),0,sub->attribute);
HeapFree(GetProcessHeap(),0,sub);
msi_free(sub->event);
msi_free(sub->control);
msi_free(sub->attribute);
msi_free(sub);
}
VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
@ -256,7 +259,7 @@ VOID ControlEvent_SubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
{
struct subscriber *sub;
sub = HeapAlloc(GetProcessHeap(),0,sizeof (*sub));
sub = msi_alloc(sizeof (*sub));
if( !sub )
return;
sub->event = strdupW(event);
@ -349,7 +352,7 @@ UINT ACTION_DialogBox( MSIPACKAGE* package, LPCWSTR szDialogName )
package->next_dialog = NULL;
r = event_do_dialog( package, name, TRUE );
HeapFree( GetProcessHeap(), 0, name );
msi_free( name );
}
if( r == ERROR_IO_PENDING )
@ -386,11 +389,11 @@ UINT ControlEvent_HandleControlEvent(MSIPACKAGE *package, LPCWSTR event,
LPWSTR wevent = strdupAtoW(Events[i].event);
if (lstrcmpW(wevent,event)==0)
{
HeapFree(GetProcessHeap(),0,wevent);
msi_free(wevent);
rc = Events[i].handler(package,argument,dialog);
return rc;
}
HeapFree(GetProcessHeap(),0,wevent);
msi_free(wevent);
i++;
}
FIXME("unhandled control event %s arg(%s)\n",

View file

@ -72,7 +72,7 @@ static UINT create_component_directory( MSIPACKAGE* package, MSICOMPONENT *comp
create_full_pathW(install_path);
folder->State = 2;
}
HeapFree(GetProcessHeap(), 0, install_path);
msi_free(install_path);
return rc;
}
@ -115,7 +115,7 @@ static UINT writeout_cabinet_stream(MSIPACKAGE *package, LPCWSTR stream_name,
CloseHandle(the_file);
TRACE("wrote %li bytes to %s\n",write,debugstr_w(source));
end:
HeapFree(GetProcessHeap(),0,data);
msi_free(data);
return rc;
}
@ -129,12 +129,12 @@ typedef struct
static void * cabinet_alloc(ULONG cb)
{
return HeapAlloc(GetProcessHeap(), 0, cb);
return msi_alloc(cb);
}
static void cabinet_free(void *pv)
{
HeapFree(GetProcessHeap(), 0, pv);
msi_free(pv);
}
static INT_PTR cabinet_open(char *pszFile, int oflag, int pmode)
@ -214,18 +214,17 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
given_file = strdupAtoW(pfdin->psz1);
f = get_loaded_file(data->package, given_file);
msi_free(given_file);
if (!f)
{
ERR("Unknown File in Cabinent (%s)\n",debugstr_w(given_file));
HeapFree(GetProcessHeap(),0,given_file);
ERR("Unknown File in Cabinet (%s)\n",debugstr_a(pfdin->psz1));
return 0;
}
if (!((f->State == 1 || f->State == 2)))
{
TRACE("Skipping extraction of %s\n",debugstr_w(given_file));
HeapFree(GetProcessHeap(),0,given_file);
TRACE("Skipping extraction of %s\n",debugstr_a(pfdin->psz1));
return 0;
}
@ -238,7 +237,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
/* track this file so it can be deleted if not installed */
trackpath=strdupAtoW(file);
tracknametmp=strdupAtoW(strrchr(file,'\\')+1);
trackname = HeapAlloc(GetProcessHeap(),0,(strlenW(tracknametmp) +
trackname = msi_alloc((strlenW(tracknametmp) +
strlenW(tmpprefix)+1) * sizeof(WCHAR));
strcpyW(trackname,tmpprefix);
@ -246,9 +245,9 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
track_tempfile(data->package, trackname, trackpath);
HeapFree(GetProcessHeap(),0,trackpath);
HeapFree(GetProcessHeap(),0,trackname);
HeapFree(GetProcessHeap(),0,tracknametmp);
msi_free(trackpath);
msi_free(trackname);
msi_free(tracknametmp);
/* the UI chunk */
uirow=MSI_CreateRecord(9);
@ -259,7 +258,7 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
MSI_RecordSetInteger( uirow, 6, f->FileSize );
ui_actiondata(data->package,szInstallFiles,uirow);
msiobj_release( &uirow->hdr );
HeapFree(GetProcessHeap(),0,uipath);
msi_free(uipath);
ui_progress( data->package, 2, f->FileSize, 0, 0);
@ -324,7 +323,7 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source,
if (!(cab_path = strdupWtoA( path )))
{
FDIDestroy(hfdi);
HeapFree(GetProcessHeap(), 0, cabinet);
msi_free(cabinet);
return FALSE;
}
@ -338,8 +337,8 @@ static BOOL extract_cabinet_file(MSIPACKAGE* package, LPCWSTR source,
FDIDestroy(hfdi);
HeapFree(GetProcessHeap(), 0, cabinet);
HeapFree(GetProcessHeap(), 0, cab_path);
msi_free(cabinet);
msi_free(cab_path);
return ret;
}
@ -352,7 +351,7 @@ static VOID set_file_source(MSIPACKAGE* package, MSIFILE* file, MSICOMPONENT*
LPWSTR p;
p = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL);
file->SourcePath = build_directory_name(2, p, file->ShortName);
HeapFree(GetProcessHeap(),0,p);
msi_free(p);
}
else
file->SourcePath = build_directory_name(2, path, file->File);
@ -419,25 +418,55 @@ static UINT ready_volume(MSIPACKAGE* package, LPCWSTR path, LPWSTR last_volume,
prompt = MSI_RecordGetString(row,3);
msg = generate_error_string(package, 1302, 1, prompt);
rc = MessageBoxW(NULL,msg,NULL,MB_OKCANCEL);
HeapFree(GetProcessHeap(),0,volume);
HeapFree(GetProcessHeap(),0,msg);
msi_free(volume);
msi_free(msg);
if (rc == IDOK)
ok = check_for_sourcefile(path);
else
return ERROR_INSTALL_USEREXIT;
}
HeapFree(GetProcessHeap(),0,last_volume);
msi_free(last_volume);
last_volume = strdupW(volume);
return ERROR_SUCCESS;
}
static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
MSICOMPONENT* comp)
struct media_info {
UINT last_sequence;
LPWSTR last_volume;
LPWSTR last_path;
DWORD count;
WCHAR source[MAX_PATH];
};
static struct media_info *create_media_info( void )
{
struct media_info *mi;
mi = msi_alloc( sizeof *mi );
if (mi)
{
mi->last_sequence = 0;
mi->last_volume = NULL;
mi->last_path = NULL;
mi->count = 0;
mi->source[0] = 0;
}
return mi;
}
static void free_media_info( struct media_info *mi )
{
msi_free( mi->last_path );
msi_free( mi );
}
static UINT ready_media_for_file( MSIPACKAGE *package, struct media_info *mi,
MSIFILE *file, MSICOMPONENT* comp )
{
UINT rc = ERROR_SUCCESS;
MSIRECORD * row = 0;
static WCHAR source[MAX_PATH];
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
'`','M','e','d','i','a','`',' ','W','H','E','R','E',' ',
@ -447,34 +476,17 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
LPCWSTR cab, volume;
DWORD sz;
INT seq;
static UINT last_sequence = 0;
static LPWSTR last_volume = NULL;
static LPWSTR last_path = NULL;
UINT type;
LPCWSTR prompt;
static DWORD count = 0;
/* cleanup signal */
if (!package)
if (file->Sequence <= mi->last_sequence)
{
HeapFree(GetProcessHeap(),0,last_path);
HeapFree(GetProcessHeap(),0,last_volume);
last_sequence = 0;
last_path = NULL;
last_volume = NULL;
count = 0;
memset(source,0,sizeof(source));
set_file_source(package,file,comp,mi->last_path);
TRACE("Media already ready (%u, %u)\n",file->Sequence,mi->last_sequence);
return ERROR_SUCCESS;
}
if (file->Sequence <= last_sequence)
{
set_file_source(package,file,comp,last_path);
TRACE("Media already ready (%u, %u)\n",file->Sequence,last_sequence);
return ERROR_SUCCESS;
}
count ++;
mi->count ++;
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, file->Sequence);
if (!row)
{
@ -483,22 +495,22 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
}
seq = MSI_RecordGetInteger(row,2);
last_sequence = seq;
mi->last_sequence = seq;
volume = MSI_RecordGetString(row, 5);
prompt = MSI_RecordGetString(row, 3);
HeapFree(GetProcessHeap(),0,last_path);
last_path = NULL;
msi_free(mi->last_path);
mi->last_path = NULL;
if (file->Attributes & msidbFileAttributesNoncompressed)
{
last_path = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL);
set_file_source(package,file,comp,last_path);
rc = ready_volume(package, file->SourcePath, last_volume, row,&type);
mi->last_path = resolve_folder(package, comp->Directory, TRUE, FALSE, NULL);
set_file_source(package,file,comp,mi->last_path);
rc = ready_volume(package, file->SourcePath, mi->last_volume, row,&type);
MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, count, volume,
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, mi->count, volume,
prompt);
if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM ||
@ -506,12 +518,12 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT|MSISOURCETYPE_MEDIA,
INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->last_path);
else
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->last_path);
msiobj_release(&row->hdr);
return rc;
}
@ -525,14 +537,14 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
{
LPWSTR path;
writeout_cabinet_stream(package,&cab[1],source);
last_path = strdupW(source);
*(strrchrW(last_path,'\\')+1)=0;
writeout_cabinet_stream(package,&cab[1],mi->source);
mi->last_path = strdupW(mi->source);
*(strrchrW(mi->last_path,'\\')+1)=0;
path = load_dynamic_property(package,cszSourceDir,NULL);
path = msi_dup_property( package, cszSourceDir );
MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, count,
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, mi->count,
volume, prompt);
MsiSourceListSetInfoW(package->ProductCode, NULL,
@ -540,68 +552,68 @@ static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_LASTUSEDSOURCEW, path);
HeapFree(GetProcessHeap(),0,path);
msi_free(path);
}
else
{
sz = MAX_PATH;
last_path = HeapAlloc(GetProcessHeap(),0,MAX_PATH*sizeof(WCHAR));
if (MSI_GetPropertyW(package, cszSourceDir, source, &sz))
mi->last_path = msi_alloc(MAX_PATH*sizeof(WCHAR));
if (MSI_GetPropertyW(package, cszSourceDir, mi->source, &sz))
{
ERR("No Source dir defined \n");
rc = ERROR_FUNCTION_FAILED;
}
else
{
strcpyW(last_path,source);
strcatW(source,cab);
strcpyW(mi->last_path,mi->source);
strcatW(mi->source,cab);
rc = ready_volume(package, source, last_volume, row, &type);
rc = ready_volume(package, mi->source, mi->last_volume, row, &type);
if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM ||
type == DRIVE_RAMDISK)
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT|MSISOURCETYPE_MEDIA,
INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->last_path);
else
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->last_path);
/* extract the cab file into a folder in the temp folder */
sz = MAX_PATH;
if (MSI_GetPropertyW(package, cszTempFolder,last_path, &sz)
if (MSI_GetPropertyW(package, cszTempFolder,mi->last_path, &sz)
!= ERROR_SUCCESS)
GetTempPathW(MAX_PATH,last_path);
GetTempPathW(MAX_PATH,mi->last_path);
}
}
rc = !extract_cabinet_file(package, source, last_path);
rc = !extract_cabinet_file(package, mi->source, mi->last_path);
}
else
{
sz = MAX_PATH;
last_path = HeapAlloc(GetProcessHeap(),0,MAX_PATH*sizeof(WCHAR));
MSI_GetPropertyW(package,cszSourceDir,source,&sz);
strcpyW(last_path,source);
rc = ready_volume(package, last_path, last_volume, row, &type);
mi->last_path = msi_alloc(MAX_PATH*sizeof(WCHAR));
MSI_GetPropertyW(package,cszSourceDir,mi->source,&sz);
strcpyW(mi->last_path,mi->source);
rc = ready_volume(package, mi->last_path, mi->last_volume, row, &type);
if (type == DRIVE_REMOVABLE || type == DRIVE_CDROM ||
type == DRIVE_RAMDISK)
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT|MSISOURCETYPE_MEDIA,
INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->last_path);
else
MsiSourceListSetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT|MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_LASTUSEDSOURCEW, last_path);
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->last_path);
}
set_file_source(package, file, comp, last_path);
set_file_source(package, file, comp, mi->last_path);
MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, count, volume,
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, mi->count, volume,
prompt);
msiobj_release(&row->hdr);
@ -643,6 +655,7 @@ static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
*/
UINT ACTION_InstallFiles(MSIPACKAGE *package)
{
struct media_info *mi;
UINT rc = ERROR_SUCCESS;
LPWSTR ptr;
MSIFILE *file;
@ -670,9 +683,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
{
MSICOMPONENT* comp = NULL;
if (file->Temporary)
continue;
if (!ACTION_VerifyComponentForAction(package, file->Component,
INSTALLSTATE_LOCAL))
{
@ -702,24 +712,23 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
}
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
HeapFree(GetProcessHeap(),0,file->TargetPath);
msi_free(file->TargetPath);
file->TargetPath = build_directory_name(2, p, file->FileName);
HeapFree(GetProcessHeap(),0,p);
msi_free(p);
}
}
mi = create_media_info();
/* Pass 2 */
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
{
if (file->Temporary)
continue;
if ((file->State == 1) || (file->State == 2))
{
TRACE("Pass 2: %s\n",debugstr_w(file->File));
rc = ready_media_for_file( package, file, file->Component );
rc = ready_media_for_file( package, mi, file, file->Component );
if (rc != ERROR_SUCCESS)
{
ERR("Unable to ready media\n");
@ -771,7 +780,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
}
/* cleanup */
ready_media_for_file(NULL, NULL, NULL);
free_media_info( mi );
return rc;
}
@ -814,7 +823,7 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if (rc != ERROR_SUCCESS)
{
ERR("Original file unknown %s\n",debugstr_w(file_key));
HeapFree(GetProcessHeap(),0,file_source);
msi_free(file_source);
return ERROR_SUCCESS;
}
@ -843,11 +852,11 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
if (!dest_path)
{
/* try a Property */
dest_path = load_dynamic_property(package, destkey, NULL);
dest_path = msi_dup_property( package, destkey );
if (!dest_path)
{
FIXME("Unable to get destination folder, try AppSearch properties\n");
HeapFree(GetProcessHeap(),0,file_source);
msi_free(file_source);
return ERROR_SUCCESS;
}
}
@ -868,9 +877,9 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
FIXME("We should track these duplicate files as well\n");
HeapFree(GetProcessHeap(),0,dest_path);
HeapFree(GetProcessHeap(),0,dest);
HeapFree(GetProcessHeap(),0,file_source);
msi_free(dest_path);
msi_free(dest);
msi_free(file_source);
return ERROR_SUCCESS;
}

View file

@ -56,7 +56,7 @@ static LPWSTR build_default_format(MSIRECORD* record)
count = MSI_RecordGetFieldCount(record);
rc = HeapAlloc(GetProcessHeap(),0,(11*count)*sizeof(WCHAR));
rc = msi_alloc((11*count)*sizeof(WCHAR));
rc[0] = 0;
for (i = 1; i <= count; i++)
{
@ -85,7 +85,7 @@ static LPWSTR deformat_component(MSIPACKAGE* package, LPCWSTR key, DWORD* sz)
if (!package)
return NULL;
ERR("POORLY HANDLED DEFORMAT.. [$componentkey] \n");
FIXME("component key %s\n", debugstr_w(key));
comp = get_loaded_component(package,key);
if (comp)
{
@ -124,7 +124,7 @@ static LPWSTR deformat_file(MSIPACKAGE* package, LPCWSTR key, DWORD* sz,
{
*sz = (size-1) * sizeof (WCHAR);
size ++;
value = HeapAlloc(GetProcessHeap(),0,size * sizeof(WCHAR));
value = msi_alloc(size * sizeof(WCHAR));
GetShortPathNameW( file->TargetPath, value, size );
}
else
@ -150,7 +150,7 @@ static LPWSTR deformat_environment(MSIPACKAGE* package, LPCWSTR key,
if (sz > 0)
{
sz++;
value = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR));
value = msi_alloc(sz * sizeof(WCHAR));
GetEnvironmentVariableW(&key[1],value,sz);
*chunk = (strlenW(value)) * sizeof(WCHAR);
}
@ -168,7 +168,7 @@ static LPWSTR deformat_NULL(DWORD* chunk)
{
LPWSTR value;
value = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*2);
value = msi_alloc(sizeof(WCHAR)*2);
value[0] = 0;
*chunk = sizeof(WCHAR);
return value;
@ -178,7 +178,7 @@ static LPWSTR deformat_escape(LPCWSTR key, DWORD* chunk)
{
LPWSTR value;
value = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*2);
value = msi_alloc(sizeof(WCHAR)*2);
value[0] = key[0];
*chunk = sizeof(WCHAR);
@ -219,15 +219,14 @@ static LPWSTR deformat_index(MSIRECORD* record, LPCWSTR key, DWORD* chunk )
static LPWSTR deformat_property(MSIPACKAGE* package, LPCWSTR key, DWORD* chunk)
{
UINT rc;
LPWSTR value;
if (!package)
return NULL;
value = load_dynamic_property(package,key, &rc);
value = msi_dup_property( package, key );
if (rc == ERROR_SUCCESS)
if (value)
*chunk = (strlenW(value)) * sizeof(WCHAR);
return value;
@ -261,7 +260,7 @@ static BOOL find_next_group(LPCWSTR source, DWORD len_remaining,
*mark2 = &(*mark)[i];
i = *mark2 - *mark;
*group = HeapAlloc(GetProcessHeap(),0,i*sizeof(WCHAR));
*group = msi_alloc(i*sizeof(WCHAR));
i -= 1;
memcpy(*group,&(*mark)[1],i*sizeof(WCHAR));
@ -307,7 +306,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining,
*mark2 = &(*mark)[i-1];
i = *mark2 - *mark;
*key = HeapAlloc(GetProcessHeap(),0,i*sizeof(WCHAR));
*key = msi_alloc(i*sizeof(WCHAR));
/* do not have the [] in the key */
i -= 1;
memcpy(*key,&(*mark)[1],i*sizeof(WCHAR));
@ -320,7 +319,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining,
static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
MSIRECORD* record, DWORD* size)
{
LPWSTR value;
LPWSTR value = NULL;
LPCWSTR mark, mark2;
LPWSTR key;
BOOL nested;
@ -338,14 +337,14 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
if (!find_next_outermost_key(group, len, &key, &mark, &mark2, &nested))
{
*size = (len+2)*sizeof(WCHAR);
value = HeapAlloc(GetProcessHeap(),0,*size);
value = msi_alloc(*size);
sprintfW(value,fmt,group);
/* do not return size of the null at the end */
*size = (len+1)*sizeof(WCHAR);
return value;
}
HeapFree(GetProcessHeap(),0,key);
msi_free(key);
failcount = 0;
sz = deformat_string_internal(package, group, &value, strlenW(group),
record, &failcount);
@ -358,17 +357,18 @@ static LPWSTR deformat_group(MSIPACKAGE* package, LPWSTR group, DWORD len,
{
LPWSTR v2;
v2 = HeapAlloc(GetProcessHeap(),0,(sz+2)*sizeof(WCHAR));
v2 = msi_alloc((sz+2)*sizeof(WCHAR));
v2[0] = '{';
memcpy(&v2[1],value,sz*sizeof(WCHAR));
v2[sz+1]='}';
HeapFree(GetProcessHeap(),0,value);
msi_free(value);
*size = (sz+2)*sizeof(WCHAR);
return v2;
}
else
{
msi_free(value);
*size = 0;
return NULL;
}
@ -408,7 +408,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
(scanW(ptr,'{',len) && !scanW(ptr,'}',len)))
{
/* not formatted */
*data = HeapAlloc(GetProcessHeap(),0,(len*sizeof(WCHAR)));
*data = msi_alloc((len*sizeof(WCHAR)));
memcpy(*data,ptr,len*sizeof(WCHAR));
TRACE("Returning %s\n",debugstr_wn(*data,len));
return len;
@ -424,6 +424,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
{
value = deformat_group(package, key, strlenW(key)+1, record,
&chunk);
msi_free( key );
key = NULL;
nested = FALSE;
}
@ -438,9 +439,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
chunk = (len - (progress - ptr)) * sizeof(WCHAR);
TRACE("after chunk is %li + %li\n",size,chunk);
if (size)
nd2 = HeapReAlloc(GetProcessHeap(),0,newdata,(size+chunk));
nd2 = msi_realloc(newdata,(size+chunk));
else
nd2 = HeapAlloc(GetProcessHeap(),0,chunk);
nd2 = msi_alloc(chunk);
newdata = nd2;
memcpy(&newdata[size],progress,chunk);
@ -456,9 +457,9 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
TRACE("%i (%i) characters before marker\n",cnt,(mark-progress));
size += cnt * sizeof(WCHAR);
if (!old_size)
tgt = HeapAlloc(GetProcessHeap(),0,size);
tgt = msi_alloc(size);
else
tgt = HeapReAlloc(GetProcessHeap(),0,newdata,size);
tgt = msi_realloc(newdata,size);
newdata = tgt;
memcpy(&newdata[old_size],progress,(cnt * sizeof(WCHAR)));
}
@ -471,7 +472,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
deformat_string_internal(package, key, &value, strlenW(key)+1,
record, failcount);
HeapFree(GetProcessHeap(),0,key);
msi_free(key);
key = value;
}
@ -495,7 +496,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
{
DWORD keylen = strlenW(key);
chunk = (keylen + 2)*sizeof(WCHAR);
value = HeapAlloc(GetProcessHeap(),0,chunk);
value = msi_alloc(chunk);
value[0] = '[';
memcpy(&value[1],key,keylen*sizeof(WCHAR));
value[1+keylen] = ']';
@ -533,7 +534,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
else
{
static const WCHAR fmt[] = {'[','%','s',']',0};
value = HeapAlloc(GetProcessHeap(),0,10);
value = msi_alloc(10);
sprintfW(value,fmt,key);
chunk = strlenW(value)*sizeof(WCHAR);
}
@ -543,7 +544,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
}
}
HeapFree(GetProcessHeap(),0,key);
msi_free(key);
if (value!=NULL)
{
@ -551,13 +552,13 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
TRACE("value %s, chunk %li size %li\n",debugstr_w((LPWSTR)value),
chunk, size);
if (size)
nd2= HeapReAlloc(GetProcessHeap(),0,newdata,(size + chunk));
nd2= msi_realloc(newdata,(size + chunk));
else
nd2= HeapAlloc(GetProcessHeap(),0,chunk);
nd2= msi_alloc(chunk);
newdata = nd2;
memcpy(&newdata[size],value,chunk);
size+=chunk;
HeapFree(GetProcessHeap(),0,value);
msi_free(value);
}
else if (failcount && *failcount >=0 )
(*failcount)++;
@ -615,8 +616,8 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer,
*size = len;
HeapFree(GetProcessHeap(),0,rec);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(rec);
msi_free(deformated);
return rc;
}
@ -659,8 +660,8 @@ UINT MSI_FormatRecordA( MSIPACKAGE* package, MSIRECORD* record, LPSTR buffer,
*size = lenA;
HeapFree(GetProcessHeap(),0,rec);
HeapFree(GetProcessHeap(),0,deformated);
msi_free(rec);
msi_free(deformated);
return rc;
}

View file

@ -37,7 +37,7 @@ static CRITICAL_SECTION_DEBUG MSI_handle_cs_debug =
0, 0, &MSI_handle_cs,
{ &MSI_handle_cs_debug.ProcessLocksList,
&MSI_handle_cs_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": MSI_handle_cs") }
0, 0, { (DWORD_PTR)(__FILE__ ": MSI_handle_cs") }
};
static CRITICAL_SECTION MSI_handle_cs = { &MSI_handle_cs_debug, -1, 0, 0, 0, 0 };
@ -47,7 +47,7 @@ static CRITICAL_SECTION_DEBUG MSI_object_cs_debug =
0, 0, &MSI_object_cs,
{ &MSI_object_cs_debug.ProcessLocksList,
&MSI_object_cs_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": MSI_object_cs") }
0, 0, { (DWORD_PTR)(__FILE__ ": MSI_object_cs") }
};
static CRITICAL_SECTION MSI_object_cs = { &MSI_object_cs_debug, -1, 0, 0, 0, 0 };
@ -109,30 +109,11 @@ out:
return (void*) ret;
}
MSIHANDLE msiobj_findhandle( MSIOBJECTHDR *hdr )
{
MSIHANDLE ret = 0;
UINT i;
TRACE("%p\n", hdr);
EnterCriticalSection( &MSI_handle_cs );
for(i=0; (i<MSIMAXHANDLES) && !ret; i++)
if( msihandletable[i].obj == hdr )
ret = i+1;
LeaveCriticalSection( &MSI_handle_cs );
TRACE("%p -> %ld\n", hdr, ret);
msiobj_addref( hdr );
return ret;
}
void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy )
{
MSIOBJECTHDR *info;
info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
info = msi_alloc_zero( size );
if( info )
{
info->magic = MSIHANDLE_MAGIC;
@ -190,7 +171,7 @@ int msiobj_release( MSIOBJECTHDR *info )
{
if( info->destructor )
info->destructor( info );
HeapFree( GetProcessHeap(), 0, info );
msi_free( info );
TRACE("object %p destroyed\n", info);
}

View file

@ -84,11 +84,9 @@ DWORD build_version_dword(LPCWSTR version_string)
return rc;
}
UINT build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name,
LPWSTR *FilePath)
LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name )
{
LPWSTR SystemFolder;
LPWSTR dest;
LPWSTR SystemFolder, dest, FilePath;
static const WCHAR szInstaller[] =
{'M','i','c','r','o','s','o','f','t','\\',
@ -96,17 +94,17 @@ UINT build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name,
static const WCHAR szFolder[] =
{'A','p','p','D','a','t','a','F','o','l','d','e','r',0};
SystemFolder = load_dynamic_property(package,szFolder,NULL);
SystemFolder = msi_dup_property( package, szFolder );
dest = build_directory_name(3, SystemFolder, szInstaller, package->ProductCode);
create_full_pathW(dest);
*FilePath = build_directory_name(2, dest, icon_name);
FilePath = build_directory_name(2, dest, icon_name);
HeapFree(GetProcessHeap(),0,SystemFolder);
HeapFree(GetProcessHeap(),0,dest);
return ERROR_SUCCESS;
msi_free(SystemFolder);
msi_free(dest);
return FilePath;
}
WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
@ -124,24 +122,24 @@ WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
/* having an empty string is different than NULL */
if (sz == 0)
{
ret = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR));
ret = msi_alloc(sizeof(WCHAR));
ret[0] = 0;
return ret;
}
sz ++;
ret = HeapAlloc(GetProcessHeap(),0,sz * sizeof (WCHAR));
ret = msi_alloc(sz * sizeof (WCHAR));
rc = MSI_RecordGetStringW(row,index,ret,&sz);
if (rc!=ERROR_SUCCESS)
{
ERR("Unable to load dynamic string\n");
HeapFree(GetProcessHeap(), 0, ret);
msi_free(ret);
ret = NULL;
}
return ret;
}
LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc)
LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop)
{
DWORD sz = 0;
LPWSTR str;
@ -149,21 +147,16 @@ LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc)
r = MSI_GetPropertyW(package, prop, NULL, &sz);
if (r != ERROR_SUCCESS && r != ERROR_MORE_DATA)
{
if (rc)
*rc = r;
return NULL;
}
sz++;
str = HeapAlloc(GetProcessHeap(),0,sz*sizeof(WCHAR));
str = msi_alloc(sz*sizeof(WCHAR));
r = MSI_GetPropertyW(package, prop, str, &sz);
if (r != ERROR_SUCCESS)
{
HeapFree(GetProcessHeap(),0,str);
msi_free(str);
str = NULL;
}
if (rc)
*rc = r;
return str;
}
@ -205,22 +198,32 @@ MSIFILE* get_loaded_file( MSIPACKAGE* package, LPCWSTR key )
int track_tempfile( MSIPACKAGE *package, LPCWSTR name, LPCWSTR path )
{
MSIFILE *file;
MSITEMPFILE *temp;
if (!package)
return -2;
file = get_loaded_file( package, name );
if (file)
return -1;
file = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSIFILE) );
LIST_FOR_EACH_ENTRY( temp, &package->tempfiles, MSITEMPFILE, entry )
{
if (lstrcmpW( name, temp->File )==0)
{
TRACE("tempfile %s already exists with path %s\n",
debugstr_w(temp->File), debugstr_w(temp->Path));
return -1;
}
}
file->File = strdupW( name );
file->TargetPath = strdupW( path );
file->Temporary = TRUE;
temp = msi_alloc_zero( sizeof (MSITEMPFILE) );
if (!temp)
return -1;
TRACE("Tracking tempfile (%s)\n", debugstr_w( file->File ));
list_add_head( &package->tempfiles, &temp->entry );
temp->File = strdupW( name );
temp->Path = strdupW( path );
TRACE("adding tempfile %s with path %s\n",
debugstr_w(temp->File), debugstr_w(temp->Path));
return 0;
}
@ -254,10 +257,10 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
if (!source)
{
LPWSTR check_path;
check_path = load_dynamic_property(package,cszTargetDir,NULL);
check_path = msi_dup_property( package, cszTargetDir );
if (!check_path)
{
check_path = load_dynamic_property(package,cszRootDrive,NULL);
check_path = msi_dup_property( package, cszRootDrive );
if (set_prop)
MSI_SetPropertyW(package,cszTargetDir,check_path);
}
@ -266,13 +269,14 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
path = build_directory_name(2, check_path, NULL);
if (strcmpiW(path,check_path)!=0)
MSI_SetPropertyW(package,cszTargetDir,path);
msi_free(check_path);
}
else
{
path = load_dynamic_property(package,cszSourceDir,NULL);
path = msi_dup_property( package, cszSourceDir );
if (!path)
{
path = load_dynamic_property(package,cszDatabase,NULL);
path = msi_dup_property( package, cszDatabase );
if (path)
{
p = strrchrW(path,'\\');
@ -341,7 +345,7 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
TRACE(" (source)resolved into %s\n",debugstr_w(path));
f->ResolvedSource = strdupW( path );
}
HeapFree(GetProcessHeap(),0,p);
msi_free(p);
}
return path;
}
@ -359,7 +363,7 @@ DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data )
if (size >= 0)
{
size++;
*data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
*data = msi_alloc(size*sizeof(WCHAR));
if (size > 1)
MSI_FormatRecordW(package,rec,*data,&size);
else
@ -388,11 +392,10 @@ UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
count = package->script->ActionCount[script];
package->script->ActionCount[script]++;
if (count != 0)
newbuf = HeapReAlloc(GetProcessHeap(),0,
package->script->Actions[script],
newbuf = msi_realloc( package->script->Actions[script],
package->script->ActionCount[script]* sizeof(LPWSTR));
else
newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
newbuf = msi_alloc( sizeof(LPWSTR));
newbuf[count] = strdupW(action);
package->script->Actions[script] = newbuf;
@ -402,18 +405,18 @@ UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
static void remove_tracked_tempfiles(MSIPACKAGE* package)
{
MSIFILE *file;
struct list *item, *cursor;
if (!package)
return;
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
LIST_FOR_EACH_SAFE( item, cursor, &package->tempfiles )
{
if (file->Temporary)
{
TRACE("Cleaning up %s\n", debugstr_w( file->TargetPath ));
DeleteFileW( file->TargetPath );
}
MSITEMPFILE *temp = LIST_ENTRY( item, MSITEMPFILE, entry );
list_remove( &temp->entry );
TRACE("deleting temp file %s\n", debugstr_w( temp->Path ));
DeleteFileW( temp->Path );
msi_free( temp->File );
msi_free( temp->Path );
msi_free( temp );
}
}
@ -425,11 +428,35 @@ static void free_feature( MSIFEATURE *feature )
{
ComponentList *cl = LIST_ENTRY( item, ComponentList, entry );
list_remove( &cl->entry );
HeapFree( GetProcessHeap(), 0, cl );
msi_free( cl );
}
HeapFree( GetProcessHeap(), 0, feature );
msi_free( feature->Feature );
msi_free( feature->Feature_Parent );
msi_free( feature->Directory );
msi_free( feature->Description );
msi_free( feature->Title );
msi_free( feature );
}
void free_extension( MSIEXTENSION *ext )
{
struct list *item, *cursor;
LIST_FOR_EACH_SAFE( item, cursor, &ext->verbs )
{
MSIVERB *verb = LIST_ENTRY( item, MSIVERB, entry );
list_remove( &verb->entry );
msi_free( verb->Verb );
msi_free( verb->Command );
msi_free( verb->Argument );
msi_free( verb );
}
msi_free( ext->Extension );
msi_free( ext->ProgIDText );
msi_free( ext );
}
/* Called when the package is being closed */
void ACTION_free_package_structures( MSIPACKAGE* package)
@ -453,12 +480,13 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIFOLDER *folder = LIST_ENTRY( item, MSIFOLDER, entry );
list_remove( &folder->entry );
HeapFree( GetProcessHeap(), 0, folder->Directory );
HeapFree( GetProcessHeap(), 0, folder->TargetDefault );
HeapFree( GetProcessHeap(), 0, folder->SourceDefault );
HeapFree( GetProcessHeap(), 0, folder->ResolvedTarget );
HeapFree( GetProcessHeap(), 0, folder->ResolvedSource );
HeapFree( GetProcessHeap(), 0, folder->Property );
msi_free( folder->Directory );
msi_free( folder->TargetDefault );
msi_free( folder->SourceDefault );
msi_free( folder->ResolvedTarget );
msi_free( folder->ResolvedSource );
msi_free( folder->Property );
msi_free( folder );
}
LIST_FOR_EACH_SAFE( item, cursor, &package->components )
@ -466,8 +494,13 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSICOMPONENT *comp = LIST_ENTRY( item, MSICOMPONENT, entry );
list_remove( &comp->entry );
HeapFree( GetProcessHeap(), 0, comp->FullKeypath );
HeapFree( GetProcessHeap(), 0, comp );
msi_free( comp->Component );
msi_free( comp->ComponentId );
msi_free( comp->Directory );
msi_free( comp->Condition );
msi_free( comp->KeyPath );
msi_free( comp->FullKeypath );
msi_free( comp );
}
LIST_FOR_EACH_SAFE( item, cursor, &package->files )
@ -475,14 +508,14 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIFILE *file = LIST_ENTRY( item, MSIFILE, entry );
list_remove( &file->entry );
HeapFree( GetProcessHeap(), 0, file->File );
HeapFree( GetProcessHeap(), 0, file->FileName );
HeapFree( GetProcessHeap(), 0, file->ShortName );
HeapFree( GetProcessHeap(), 0, file->Version );
HeapFree( GetProcessHeap(), 0, file->Language );
HeapFree( GetProcessHeap(), 0, file->SourcePath );
HeapFree( GetProcessHeap(), 0, file->TargetPath );
HeapFree( GetProcessHeap(), 0, file );
msi_free( file->File );
msi_free( file->FileName );
msi_free( file->ShortName );
msi_free( file->Version );
msi_free( file->Language );
msi_free( file->SourcePath );
msi_free( file->TargetPath );
msi_free( file );
}
/* clean up extension, progid, class and verb structures */
@ -491,14 +524,16 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSICLASS *cls = LIST_ENTRY( item, MSICLASS, entry );
list_remove( &cls->entry );
HeapFree( GetProcessHeap(), 0, cls->Description );
HeapFree( GetProcessHeap(), 0, cls->FileTypeMask );
HeapFree( GetProcessHeap(), 0, cls->IconPath );
HeapFree( GetProcessHeap(), 0, cls->DefInprocHandler );
HeapFree( GetProcessHeap(), 0, cls->DefInprocHandler32 );
HeapFree( GetProcessHeap(), 0, cls->Argument );
HeapFree( GetProcessHeap(), 0, cls->ProgIDText );
HeapFree( GetProcessHeap(), 0, cls );
msi_free( cls->clsid );
msi_free( cls->Context );
msi_free( cls->Description );
msi_free( cls->FileTypeMask );
msi_free( cls->IconPath );
msi_free( cls->DefInprocHandler );
msi_free( cls->DefInprocHandler32 );
msi_free( cls->Argument );
msi_free( cls->ProgIDText );
msi_free( cls );
}
LIST_FOR_EACH_SAFE( item, cursor, &package->extensions )
@ -506,37 +541,28 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIEXTENSION *ext = LIST_ENTRY( item, MSIEXTENSION, entry );
list_remove( &ext->entry );
HeapFree( GetProcessHeap(), 0, ext->ProgIDText );
HeapFree( GetProcessHeap(), 0, ext );
free_extension( ext );
}
for (i = 0; i < package->loaded_progids; i++)
LIST_FOR_EACH_SAFE( item, cursor, &package->progids )
{
HeapFree(GetProcessHeap(),0,package->progids[i].ProgID);
HeapFree(GetProcessHeap(),0,package->progids[i].Description);
HeapFree(GetProcessHeap(),0,package->progids[i].IconPath);
MSIPROGID *progid = LIST_ENTRY( item, MSIPROGID, entry );
list_remove( &progid->entry );
msi_free( progid->ProgID );
msi_free( progid->Description );
msi_free( progid->IconPath );
msi_free( progid );
}
if (package->progids && package->loaded_progids > 0)
HeapFree(GetProcessHeap(),0,package->progids);
for (i = 0; i < package->loaded_verbs; i++)
{
HeapFree(GetProcessHeap(),0,package->verbs[i].Verb);
HeapFree(GetProcessHeap(),0,package->verbs[i].Command);
HeapFree(GetProcessHeap(),0,package->verbs[i].Argument);
}
if (package->verbs && package->loaded_verbs > 0)
HeapFree(GetProcessHeap(),0,package->verbs);
LIST_FOR_EACH_SAFE( item, cursor, &package->mimes )
{
MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry );
list_remove( &mt->entry );
HeapFree( GetProcessHeap(), 0, mt->ContentType );
HeapFree( GetProcessHeap(), 0, mt );
msi_free( mt->clsid );
msi_free( mt->ContentType );
msi_free( mt );
}
LIST_FOR_EACH_SAFE( item, cursor, &package->appids )
@ -544,11 +570,12 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIAPPID *appid = LIST_ENTRY( item, MSIAPPID, entry );
list_remove( &appid->entry );
HeapFree( GetProcessHeap(), 0, appid->RemoteServerName );
HeapFree( GetProcessHeap(), 0, appid->LocalServer );
HeapFree( GetProcessHeap(), 0, appid->ServiceParameters );
HeapFree( GetProcessHeap(), 0, appid->DllSurrogate );
HeapFree( GetProcessHeap(), 0, appid );
msi_free( appid->AppID );
msi_free( appid->RemoteServerName );
msi_free( appid->LocalServer );
msi_free( appid->ServiceParameters );
msi_free( appid->DllSurrogate );
msi_free( appid );
}
if (package->script)
@ -557,21 +584,22 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
{
int j;
for (j = 0; j < package->script->ActionCount[i]; j++)
HeapFree(GetProcessHeap(),0,package->script->Actions[i][j]);
msi_free(package->script->Actions[i][j]);
HeapFree(GetProcessHeap(),0,package->script->Actions[i]);
msi_free(package->script->Actions[i]);
}
for (i = 0; i < package->script->UniqueActionsCount; i++)
HeapFree(GetProcessHeap(),0,package->script->UniqueActions[i]);
msi_free(package->script->UniqueActions[i]);
HeapFree(GetProcessHeap(),0,package->script->UniqueActions);
HeapFree(GetProcessHeap(),0,package->script);
msi_free(package->script->UniqueActions);
msi_free(package->script);
}
HeapFree(GetProcessHeap(),0,package->PackagePath);
HeapFree(GetProcessHeap(),0,package->msiFilePath);
HeapFree(GetProcessHeap(),0,package->ProductCode);
msi_free(package->PackagePath);
msi_free(package->ProductCode);
msi_free(package->ActionFormat);
msi_free(package->LastAction);
/* cleanup control event subscriptions */
ControlEvent_CleanupSubscriptions(package);
@ -612,7 +640,7 @@ LPWSTR build_directory_name(DWORD count, ...)
}
va_end(va);
dir = HeapAlloc(GetProcessHeap(), 0, sz*sizeof(WCHAR));
dir = msi_alloc(sz*sizeof(WCHAR));
dir[0]=0;
va_start(va,count);
@ -641,8 +669,7 @@ BOOL create_full_pathW(const WCHAR *path)
int len;
WCHAR *new_path;
new_path = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 1) *
sizeof(WCHAR));
new_path = msi_alloc( (strlenW(path) + 1) * sizeof(WCHAR));
strcpyW(new_path, path);
@ -678,7 +705,7 @@ BOOL create_full_pathW(const WCHAR *path)
new_path[len] = '\\';
}
HeapFree(GetProcessHeap(), 0, new_path);
msi_free(new_path);
return ret;
}
@ -723,10 +750,10 @@ void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
}
/* update the cached actionformat */
HeapFree(GetProcessHeap(),0,package->ActionFormat);
msi_free(package->ActionFormat);
package->ActionFormat = load_dynamic_stringW(row,3);
HeapFree(GetProcessHeap(),0,package->LastAction);
msi_free(package->LastAction);
package->LastAction = strdupW(action);
msiobj_release(&row->hdr);
@ -749,6 +776,9 @@ void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
BOOL ACTION_VerifyComponentForAction(MSIPACKAGE* package, MSICOMPONENT* comp,
INSTALLSTATE check )
{
if (!comp)
return FALSE;
if (comp->Installed == check)
return FALSE;
@ -760,6 +790,9 @@ BOOL ACTION_VerifyComponentForAction(MSIPACKAGE* package, MSICOMPONENT* comp,
BOOL ACTION_VerifyFeatureForAction( MSIFEATURE* feature, INSTALLSTATE check )
{
if (!feature)
return FALSE;
if (feature->Installed == check)
return FALSE;
@ -822,7 +855,7 @@ LPWSTR create_component_advertise_string(MSIPACKAGE* package,
sz+=3;
sz *= sizeof(WCHAR);
output = HeapAlloc(GetProcessHeap(),0,sz);
output = msi_alloc(sz);
memset(output,0,sz);
if (component)
@ -856,39 +889,37 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
if (!component->Enabled)
continue;
else
if (newstate == INSTALLSTATE_LOCAL)
{
if (newstate == INSTALLSTATE_LOCAL)
{
component->ActionRequest = INSTALLSTATE_LOCAL;
component->Action = INSTALLSTATE_LOCAL;
}
else
{
ComponentList *clist;
MSIFEATURE *f;
component->ActionRequest = INSTALLSTATE_LOCAL;
component->Action = INSTALLSTATE_LOCAL;
}
else
{
ComponentList *clist;
MSIFEATURE *f;
component->ActionRequest = newstate;
component->Action = newstate;
component->ActionRequest = newstate;
component->Action = newstate;
/*if any other feature wants is local we need to set it local*/
LIST_FOR_EACH_ENTRY( f, &package->features, MSIFEATURE, entry )
/*if any other feature wants is local we need to set it local*/
LIST_FOR_EACH_ENTRY( f, &package->features, MSIFEATURE, entry )
{
if ( component->ActionRequest != INSTALLSTATE_LOCAL )
break;
LIST_FOR_EACH_ENTRY( clist, &f->Components, ComponentList, entry )
{
if ( component->ActionRequest != INSTALLSTATE_LOCAL )
break;
LIST_FOR_EACH_ENTRY( clist, &f->Components, ComponentList, entry )
if ( clist->component == component )
{
if ( clist->component == component )
if (f->ActionRequest == INSTALLSTATE_LOCAL)
{
if (f->ActionRequest == INSTALLSTATE_LOCAL)
{
TRACE("Saved by %s\n", debugstr_w(f->Feature));
component->ActionRequest = INSTALLSTATE_LOCAL;
component->Action = INSTALLSTATE_LOCAL;
}
break;
TRACE("Saved by %s\n", debugstr_w(f->Feature));
component->ActionRequest = INSTALLSTATE_LOCAL;
component->Action = INSTALLSTATE_LOCAL;
}
break;
}
}
}
@ -912,16 +943,15 @@ UINT register_unique_action(MSIPACKAGE *package, LPCWSTR action)
count = package->script->UniqueActionsCount;
package->script->UniqueActionsCount++;
if (count != 0)
newbuf = HeapReAlloc(GetProcessHeap(),0,
package->script->UniqueActions,
newbuf = msi_realloc( package->script->UniqueActions,
package->script->UniqueActionsCount* sizeof(LPWSTR));
else
newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(LPWSTR));
newbuf = msi_alloc( sizeof(LPWSTR));
newbuf[count] = strdupW(action);
package->script->UniqueActions = newbuf;
return ERROR_SUCCESS;
return ERROR_SUCCESS;
}
BOOL check_unique_action(MSIPACKAGE *package, LPCWSTR action)
@ -973,7 +1003,7 @@ WCHAR* generate_error_string(MSIPACKAGE *package, UINT error, DWORD count, ... )
if (size >= 0)
{
size++;
data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
data = msi_alloc(size*sizeof(WCHAR));
if (size > 1)
MSI_FormatRecordW(package,rec,data,&size);
else

View file

@ -209,7 +209,7 @@ static UINT INSERT_delete( struct tagMSIVIEW *view )
if( sv )
sv->ops->delete( sv );
msiobj_release( &iv->db->hdr );
HeapFree( GetProcessHeap(), 0, iv );
msi_free( iv );
return ERROR_SUCCESS;
}
@ -250,7 +250,7 @@ UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
return r;
}
iv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *iv );
iv = msi_alloc_zero( sizeof *iv );
if( !iv )
return ERROR_FUNCTION_FAILED;

View file

@ -41,24 +41,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
{
LPWSTR szwAction;
UINT rc;
UINT ret;
TRACE(" exteral attempt at action %s\n",szAction);
if (!szAction)
return ERROR_FUNCTION_FAILED;
if (hInstall == 0)
return ERROR_FUNCTION_FAILED;
TRACE("%s\n", debugstr_a(szAction));
szwAction = strdupAtoW(szAction);
if (!szwAction)
if (szAction && !szwAction)
return ERROR_FUNCTION_FAILED;
rc = MsiDoActionW(hInstall, szwAction);
HeapFree(GetProcessHeap(),0,szwAction);
return rc;
ret = MsiDoActionW( hInstall, szwAction );
msi_free( szwAction );
return ret;
}
/***********************************************************************
@ -67,159 +60,235 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
{
MSIPACKAGE *package;
UINT ret = ERROR_INVALID_HANDLE;
UINT ret;
TRACE(" external attempt at action %s \n",debugstr_w(szAction));
TRACE("%s\n",debugstr_w(szAction));
if (!szAction)
return ERROR_INVALID_PARAMETER;
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package)
return ERROR_INVALID_HANDLE;
ret = ACTION_PerformUIAction( package, szAction );
msiobj_release( &package->hdr );
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if( package )
{
ret = ACTION_PerformUIAction(package,szAction);
msiobj_release( &package->hdr );
}
return ret;
}
/***********************************************************************
* MsiSequenceA (MSI.@)
*/
UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode )
{
LPWSTR szwTable;
UINT ret;
TRACE("%s\n", debugstr_a(szTable));
szwTable = strdupAtoW(szTable);
if (szTable && !szwTable)
return ERROR_FUNCTION_FAILED;
ret = MsiSequenceW( hInstall, szwTable, iSequenceMode );
msi_free( szwTable );
return ret;
}
/***********************************************************************
* MsiSequenceW (MSI.@)
*/
UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode )
{
MSIPACKAGE *package;
UINT ret;
TRACE("%s\n", debugstr_w(szTable));
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package)
return ERROR_INVALID_HANDLE;
ret = MSI_Sequence( package, szTable, iSequenceMode );
msiobj_release( &package->hdr );
return ret;
}
static UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz )
{
UINT len, r = ERROR_SUCCESS;
if (awbuf->str.w && !sz )
return ERROR_INVALID_PARAMETER;
if (!sz)
return r;
if (awbuf->unicode)
{
len = lstrlenW( str );
if (awbuf->str.w)
lstrcpynW( awbuf->str.w, str, *sz );
}
else
{
len = WideCharToMultiByte( CP_ACP, 0, str, -1,
awbuf->str.a, *sz, NULL, NULL );
len--;
}
if (len >= *sz)
r = ERROR_MORE_DATA;
*sz = len;
return r;
}
/***********************************************************************
* MsiGetTargetPath (internal)
*/
UINT WINAPI MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
awstring *szPathBuf, DWORD* pcchPathBuf )
{
MSIPACKAGE *package;
LPWSTR path;
UINT r;
if (!szFolder)
return ERROR_INVALID_PARAMETER;
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package)
return ERROR_INVALID_HANDLE;
path = resolve_folder( package, szFolder, FALSE, FALSE, NULL );
msiobj_release( &package->hdr );
if (!path)
return ERROR_DIRECTORY;
r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
msi_free( path );
return r;
}
/***********************************************************************
* MsiGetTargetPathA (MSI.@)
*/
UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
LPSTR szPathBuf, DWORD* pcchPathBuf)
LPSTR szPathBuf, DWORD* pcchPathBuf )
{
LPWSTR szwFolder;
LPWSTR szwPathBuf;
UINT rc;
awstring path;
UINT r;
TRACE("getting folder %s %p %li\n",szFolder,szPathBuf, *pcchPathBuf);
if (!szFolder)
return ERROR_FUNCTION_FAILED;
if (hInstall == 0)
return ERROR_FUNCTION_FAILED;
TRACE("%s %p %p\n", debugstr_a(szFolder), szPathBuf, pcchPathBuf);
szwFolder = strdupAtoW(szFolder);
if (!szwFolder)
if (szFolder && !szwFolder)
return ERROR_FUNCTION_FAILED;
szwPathBuf = HeapAlloc( GetProcessHeap(), 0 , *pcchPathBuf * sizeof(WCHAR));
path.unicode = FALSE;
path.str.a = szPathBuf;
rc = MsiGetTargetPathW(hInstall, szwFolder, szwPathBuf,pcchPathBuf);
r = MSI_GetTargetPath( hInstall, szwFolder, &path, pcchPathBuf );
WideCharToMultiByte( CP_ACP, 0, szwPathBuf, *pcchPathBuf, szPathBuf,
*pcchPathBuf, NULL, NULL );
msi_free( szwFolder );
HeapFree(GetProcessHeap(),0,szwFolder);
HeapFree(GetProcessHeap(),0,szwPathBuf);
return rc;
return r;
}
/***********************************************************************
* MsiGetTargetPathW (MSI.@)
*/
UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder, LPWSTR
szPathBuf, DWORD* pcchPathBuf)
* MsiGetTargetPathW (MSI.@)
*/
UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder,
LPWSTR szPathBuf, DWORD* pcchPathBuf )
{
LPWSTR path;
UINT rc = ERROR_FUNCTION_FAILED;
MSIPACKAGE *package;
awstring path;
TRACE("(%s %p %li)\n",debugstr_w(szFolder),szPathBuf,*pcchPathBuf);
TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf);
path.unicode = TRUE;
path.str.w = szPathBuf;
return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf );
}
/***********************************************************************
* MsiGetSourcePath (internal)
*/
static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
awstring *szPathBuf, DWORD* pcchPathBuf )
{
MSIPACKAGE *package;
LPWSTR path;
UINT r;
TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
if (!szFolder)
return ERROR_INVALID_PARAMETER;
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package)
return ERROR_INVALID_HANDLE;
path = resolve_folder(package, szFolder, FALSE, FALSE, NULL);
msiobj_release( &package->hdr );
if (path && (strlenW(path) > *pcchPathBuf))
if (szPathBuf->str.w && !pcchPathBuf )
{
*pcchPathBuf = strlenW(path)+1;
rc = ERROR_MORE_DATA;
msiobj_release( &package->hdr );
return ERROR_INVALID_PARAMETER;
}
else if (path)
{
*pcchPathBuf = strlenW(path)+1;
strcpyW(szPathBuf,path);
TRACE("Returning Path %s\n",debugstr_w(path));
rc = ERROR_SUCCESS;
}
HeapFree(GetProcessHeap(),0,path);
return rc;
}
/***********************************************************************
* MsiGetSourcePathA (MSI.@)
*/
UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder,
LPSTR szPathBuf, DWORD* pcchPathBuf)
{
LPWSTR szwFolder;
LPWSTR szwPathBuf;
UINT rc;
TRACE("getting source %s %p %li\n",szFolder,szPathBuf, *pcchPathBuf);
if (!szFolder)
return ERROR_FUNCTION_FAILED;
if (hInstall == 0)
return ERROR_FUNCTION_FAILED;
szwFolder = strdupAtoW(szFolder);
if (!szwFolder)
return ERROR_FUNCTION_FAILED;
szwPathBuf = HeapAlloc( GetProcessHeap(), 0 , *pcchPathBuf * sizeof(WCHAR));
rc = MsiGetSourcePathW(hInstall, szwFolder, szwPathBuf,pcchPathBuf);
WideCharToMultiByte( CP_ACP, 0, szwPathBuf, *pcchPathBuf, szPathBuf,
*pcchPathBuf, NULL, NULL );
HeapFree(GetProcessHeap(),0,szwFolder);
HeapFree(GetProcessHeap(),0,szwPathBuf);
return rc;
}
/***********************************************************************
* MsiGetSourcePathW (MSI.@)
*/
UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder, LPWSTR
szPathBuf, DWORD* pcchPathBuf)
{
LPWSTR path;
UINT rc = ERROR_FUNCTION_FAILED;
MSIPACKAGE *package;
TRACE("(%s %p %li)\n",debugstr_w(szFolder),szPathBuf,*pcchPathBuf);
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if( !package )
return ERROR_INVALID_HANDLE;
path = resolve_folder(package, szFolder, TRUE, FALSE, NULL);
msiobj_release( &package->hdr );
if (path && strlenW(path) > *pcchPathBuf)
{
*pcchPathBuf = strlenW(path)+1;
rc = ERROR_MORE_DATA;
}
else if (path)
{
*pcchPathBuf = strlenW(path)+1;
strcpyW(szPathBuf,path);
TRACE("Returning Path %s\n",debugstr_w(path));
rc = ERROR_SUCCESS;
}
HeapFree(GetProcessHeap(),0,path);
return rc;
TRACE("path = %s\n",debugstr_w(path));
if (!path)
return ERROR_DIRECTORY;
r = msi_strcpy_to_awstring( path, szPathBuf, pcchPathBuf );
msi_free( path );
return r;
}
/***********************************************************************
* MsiGetSourcePathA (MSI.@)
*/
UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder,
LPSTR szPathBuf, DWORD* pcchPathBuf )
{
LPWSTR folder;
awstring str;
UINT r;
TRACE("%s %p %p\n", szFolder, debugstr_a(szPathBuf), pcchPathBuf);
str.unicode = FALSE;
str.str.a = szPathBuf;
folder = strdupAtoW( szFolder );
r = MSI_GetSourcePath( hInstall, folder, &str, pcchPathBuf );
msi_free( folder );
return r;
}
/***********************************************************************
* MsiGetSourcePathW (MSI.@)
*/
UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder,
LPWSTR szPathBuf, DWORD* pcchPathBuf )
{
awstring str;
TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
str.unicode = TRUE;
str.str.w = szPathBuf;
return MSI_GetSourcePath( hInstall, szFolder, &str, pcchPathBuf );
}
/***********************************************************************
* MsiSetTargetPathA (MSI.@)
@ -243,14 +312,14 @@ UINT WINAPI MsiSetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder,
szwFolderPath = strdupAtoW(szFolderPath);
if (!szwFolderPath)
{
HeapFree(GetProcessHeap(),0,szwFolder);
msi_free(szwFolder);
return ERROR_FUNCTION_FAILED;
}
rc = MsiSetTargetPathW(hInstall, szwFolder, szwFolderPath);
HeapFree(GetProcessHeap(),0,szwFolder);
HeapFree(GetProcessHeap(),0,szwFolderPath);
msi_free(szwFolder);
msi_free(szwFolderPath);
return rc;
}
@ -295,7 +364,7 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
RemoveDirectoryW(szFolderPath);
}
HeapFree(GetProcessHeap(),0,folder->Property);
msi_free(folder->Property);
folder->Property = build_directory_name(2, szFolderPath, NULL);
if (lstrcmpiW(path, folder->Property) == 0)
@ -304,10 +373,10 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
* Resolved Target has not really changed, so just
* set this folder and do not recalculate everything.
*/
HeapFree(GetProcessHeap(),0,folder->ResolvedTarget);
msi_free(folder->ResolvedTarget);
folder->ResolvedTarget = NULL;
path2 = resolve_folder(package,szFolder,FALSE,TRUE,NULL);
HeapFree(GetProcessHeap(),0,path2);
msi_free(path2);
}
else
{
@ -315,17 +384,17 @@ UINT MSI_SetTargetPathW(MSIPACKAGE *package, LPCWSTR szFolder,
LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry )
{
HeapFree( GetProcessHeap(),0,f->ResolvedTarget);
msi_free(f->ResolvedTarget);
f->ResolvedTarget=NULL;
}
LIST_FOR_EACH_ENTRY( f, &package->folders, MSIFOLDER, entry )
{
path2 = resolve_folder(package, f->Directory, FALSE, TRUE, NULL);
HeapFree(GetProcessHeap(),0,path2);
msi_free(path2);
}
}
HeapFree(GetProcessHeap(),0,path);
msi_free(path);
return ERROR_SUCCESS;
}
@ -406,7 +475,7 @@ UINT WINAPI MsiSetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature,
rc = MsiSetFeatureStateW(hInstall,szwFeature, iState);
HeapFree(GetProcessHeap(),0,szwFeature);
msi_free(szwFeature);
return rc;
}
@ -478,7 +547,7 @@ UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPSTR szFeature,
rc = MsiGetFeatureStateW(hInstall,szwFeature,piInstalled, piAction);
HeapFree( GetProcessHeap(), 0 , szwFeature);
msi_free( szwFeature);
return rc;
}
@ -534,7 +603,7 @@ UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent,
rc = MsiSetComponentStateW(hInstall, szwComponent, iState);
HeapFree(GetProcessHeap(), 0, szwComponent);
msi_free(szwComponent);
return rc;
}
@ -552,7 +621,7 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent,
rc = MsiGetComponentStateW(hInstall,szwComponent,piInstalled, piAction);
HeapFree( GetProcessHeap(), 0 , szwComponent);
msi_free( szwComponent);
return rc;
}
@ -648,10 +717,10 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
if (!package)
return ERROR_INVALID_HANDLE;
buffer = load_dynamic_property(package,szProductLanguage,NULL);
buffer = msi_dup_property( package, szProductLanguage );
langid = atoiW(buffer);
HeapFree(GetProcessHeap(),0,buffer);
msi_free(buffer);
msiobj_release (&package->hdr);
return langid;
}

View file

@ -76,19 +76,19 @@ UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
r = MsiOpenProductW( szwProd, phProduct );
HeapFree( GetProcessHeap(), 0, szwProd );
msi_free( szwProd );
return r;
}
UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
static UINT MSI_OpenProductW( LPCWSTR szProduct, MSIPACKAGE **ppackage )
{
LPWSTR path = NULL;
UINT r;
HKEY hKeyProduct = NULL;
DWORD count, type;
TRACE("%s %p\n",debugstr_w(szProduct), phProduct);
TRACE("%s %p\n", debugstr_w(szProduct), ppackage );
r = MSIREG_OpenUninstallKey(szProduct,&hKeyProduct,FALSE);
if( r != ERROR_SUCCESS )
@ -108,7 +108,7 @@ UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
}
/* now alloc and fetch the path of the database to open */
path = HeapAlloc( GetProcessHeap(), 0, count );
path = msi_alloc( count );
if( !path )
goto end;
@ -120,16 +120,30 @@ UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
goto end;
}
r = MsiOpenPackageW( path, phProduct );
r = MSI_OpenPackageW( path, ppackage );
end:
HeapFree( GetProcessHeap(), 0, path );
msi_free( path );
if( hKeyProduct )
RegCloseKey( hKeyProduct );
return r;
}
UINT WINAPI MsiOpenProductW( LPCWSTR szProduct, MSIHANDLE *phProduct )
{
MSIPACKAGE *package = NULL;
UINT r;
r = MSI_OpenProductW( szProduct, &package );
if( r == ERROR_SUCCESS )
{
*phProduct = alloc_msihandle( &package->hdr );
msiobj_release( &package->hdr );
}
return r;
}
UINT WINAPI MsiAdvertiseProductA(LPCSTR szPackagePath, LPCSTR szScriptfilePath,
LPCSTR szTransforms, LANGID lgidLanguage)
{
@ -188,8 +202,8 @@ UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
r = MsiInstallProductW( szwPath, szwCommand );
end:
HeapFree( GetProcessHeap(), 0, szwPath );
HeapFree( GetProcessHeap(), 0, szwCommand );
msi_free( szwPath );
msi_free( szwCommand );
return r;
}
@ -198,42 +212,16 @@ UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
{
MSIPACKAGE *package = NULL;
UINT r;
MSIHANDLE handle;
WCHAR path[MAX_PATH];
WCHAR filename[MAX_PATH];
static const WCHAR szMSI[] = {'M','S','I',0};
FIXME("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
r = MsiVerifyPackageW(szPackagePath);
if (r != ERROR_SUCCESS)
return r;
/* copy the msi file to a temp file to pervent locking a CD
* with a multi disc install
*/
GetTempPathW(MAX_PATH, path);
GetTempFileNameW(path, szMSI, 0, filename);
CopyFileW(szPackagePath, filename, FALSE);
TRACE("Opening relocated package %s\n",debugstr_w(filename));
r = MSI_OpenPackageW(filename, &package);
if (r != ERROR_SUCCESS)
r = MSI_OpenPackageW( szPackagePath, &package );
if (r == ERROR_SUCCESS)
{
DeleteFileW(filename);
return r;
r = MSI_InstallPackage( package, szPackagePath, szCommandLine );
msiobj_release( &package->hdr );
}
handle = alloc_msihandle( &package->hdr );
r = ACTION_DoTopLevelINSTALL(package, szPackagePath, szCommandLine,
filename);
MsiCloseHandle(handle);
msiobj_release( &package->hdr );
DeleteFileW(filename);
return r;
}
@ -268,9 +256,8 @@ UINT WINAPI MsiApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szInstallPackage,
UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
{
MSIHANDLE handle = -1;
MSIPACKAGE* package;
UINT rc;
MSIPACKAGE* package = NULL;
UINT r;
DWORD sz;
WCHAR sourcepath[MAX_PATH];
WCHAR filename[MAX_PATH];
@ -297,7 +284,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
strcatW(sourcepath,filename);
lstrcatW(sourcepath,filename);
/*
* ok 1, we need to find the msi file for this product.
@ -306,42 +293,37 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
* 4, cleanupany runonce entry.
*/
rc = MsiOpenProductW(szProduct,&handle);
if (rc != ERROR_SUCCESS)
goto end;
r = MSI_OpenProductW( szProduct, &package );
if (r != ERROR_SUCCESS)
return r;
package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
if (!package)
{
rc = ERROR_INVALID_HANDLE;
goto end;
}
sz = lstrlenW(szInstalled);
sz = lstrlenW(szInstalled) + 1;
if (szCommandLine)
sz += lstrlenW(szCommandLine);
commandline = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR));
commandline = msi_alloc(sz * sizeof(WCHAR));
if (!commandline )
{
r = ERROR_OUTOFMEMORY;
goto end;
}
commandline[0] = 0;
if (szCommandLine)
lstrcpyW(commandline,szCommandLine);
else
commandline[0] = 0;
if (MsiQueryProductStateW(szProduct) != INSTALLSTATE_UNKNOWN)
lstrcatW(commandline,szInstalled);
rc = ACTION_DoTopLevelINSTALL(package, sourcepath, commandline, sourcepath);
r = MSI_InstallPackage( package, sourcepath, commandline );
msi_free(commandline);
end:
msiobj_release( &package->hdr );
HeapFree(GetProcessHeap(),0,commandline);
end:
if (handle != -1)
MsiCloseHandle(handle);
return rc;
return r;
}
UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
@ -368,8 +350,8 @@ UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
r = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
szwCommandLine );
end:
HeapFree( GetProcessHeap(), 0, szwProduct );
HeapFree( GetProcessHeap(), 0, szwCommandLine);
msi_free( szwProduct );
msi_free( szwCommandLine);
return r;
}
@ -390,7 +372,7 @@ UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
}
r = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
HeapFree( GetProcessHeap(), 0, szwProduct );
msi_free( szwProduct );
return r;
}
@ -423,7 +405,7 @@ UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
if( ERROR_SUCCESS == r )
WideCharToMultiByte(CP_ACP, 0, szwBuffer, -1, szBuffer, GUID_SIZE, NULL, NULL);
HeapFree( GetProcessHeap(), 0, szwComponent );
msi_free( szwComponent );
return r;
}
@ -490,7 +472,7 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
if( szBuffer )
{
szwBuffer = HeapAlloc( GetProcessHeap(), 0, (*pcchValueBuf) * sizeof(WCHAR) );
szwBuffer = msi_alloc( (*pcchValueBuf) * sizeof(WCHAR) );
pcchwValueBuf = *pcchValueBuf;
if( !szwBuffer )
goto end;
@ -500,13 +482,18 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
&pcchwValueBuf );
if( ERROR_SUCCESS == r )
{
INT old_len = *pcchValueBuf;
*pcchValueBuf = WideCharToMultiByte(CP_ACP, 0, szwBuffer, pcchwValueBuf,
szBuffer, *pcchValueBuf, NULL, NULL);
if (old_len > *pcchValueBuf)
szBuffer[*pcchValueBuf]=0;
}
end:
HeapFree( GetProcessHeap(), 0, szwProduct );
HeapFree( GetProcessHeap(), 0, szwAttribute );
HeapFree( GetProcessHeap(), 0, szwBuffer );
msi_free( szwProduct );
msi_free( szwAttribute );
msi_free( szwBuffer );
return r;
}
@ -619,7 +606,7 @@ UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
return ERROR_OUTOFMEMORY;
}
r = MsiEnableLogW( dwLogMode, szwLogFile, attributes );
HeapFree( GetProcessHeap(), 0, szwLogFile );
msi_free( szwLogFile );
return r;
}
@ -654,7 +641,7 @@ INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
return ERROR_OUTOFMEMORY;
}
r = MsiQueryProductStateW( szwProduct );
HeapFree( GetProcessHeap(), 0, szwProduct );
msi_free( szwProduct );
return r;
}
@ -816,7 +803,7 @@ LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
LANGID r;
DWORD len;
bufW = HeapAlloc(GetProcessHeap(), 0, nBufferMax*sizeof(WCHAR));
bufW = msi_alloc(nBufferMax*sizeof(WCHAR));
r = MsiLoadStringW(handle, id, bufW, nBufferMax, lang);
if( r )
{
@ -827,7 +814,7 @@ LANGID WINAPI MsiLoadStringA( MSIHANDLE handle, UINT id, LPSTR lpBuffer,
else
r = 0;
}
HeapFree(GetProcessHeap(), 0, bufW);
msi_free(bufW);
return r;
}
@ -943,7 +930,7 @@ UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage )
r = MsiVerifyPackageW( szPack );
HeapFree( GetProcessHeap(), 0, szPack );
msi_free( szPack );
return r;
}
@ -980,14 +967,14 @@ INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
szwComponent = strdupAtoW( szComponent );
if( !szwComponent )
{
HeapFree( GetProcessHeap(), 0, szwProduct);
msi_free( szwProduct);
return ERROR_OUTOFMEMORY;
}
}
if( pcchBuf && *pcchBuf > 0 )
{
lpwPathBuf = HeapAlloc( GetProcessHeap(), 0, *pcchBuf * sizeof(WCHAR));
lpwPathBuf = msi_alloc( *pcchBuf * sizeof(WCHAR));
incoming_len = *pcchBuf;
}
else
@ -998,14 +985,14 @@ INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
rc = MsiGetComponentPathW(szwProduct, szwComponent, lpwPathBuf, pcchBuf);
HeapFree( GetProcessHeap(), 0, szwProduct);
HeapFree( GetProcessHeap(), 0, szwComponent);
msi_free( szwProduct);
msi_free( szwComponent);
if (lpwPathBuf)
{
if (rc != INSTALLSTATE_UNKNOWN)
WideCharToMultiByte(CP_ACP, 0, lpwPathBuf, incoming_len,
lpPathBuf, incoming_len, NULL, NULL);
HeapFree( GetProcessHeap(), 0, lpwPathBuf);
msi_free( lpwPathBuf);
}
return rc;
@ -1048,7 +1035,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
goto end;
sz += sizeof(WCHAR);
path = HeapAlloc( GetProcessHeap(), 0, sz );
path = msi_alloc( sz );
if( !path )
goto end;
@ -1082,7 +1069,7 @@ INSTALLSTATE WINAPI MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent,
}
end:
HeapFree(GetProcessHeap(), 0, path );
msi_free(path );
RegCloseKey(hkey);
return rrc;
}
@ -1108,15 +1095,15 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
szwFeature = strdupAtoW( szFeature );
if( !szwFeature)
{
HeapFree( GetProcessHeap(), 0, szwProduct);
msi_free( szwProduct);
return ERROR_OUTOFMEMORY;
}
}
rc = MsiQueryFeatureStateW(szwProduct, szwFeature);
HeapFree( GetProcessHeap(), 0, szwProduct);
HeapFree( GetProcessHeap(), 0, szwFeature);
msi_free( szwProduct);
msi_free( szwFeature);
return rc;
}
@ -1167,14 +1154,14 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
{
lpwVersionBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf*sizeof(WCHAR));
lpwVersionBuff = msi_alloc(*pcchVersionBuf*sizeof(WCHAR));
if( !lpwVersionBuff )
goto end;
}
if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
{
lpwLangBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf*sizeof(WCHAR));
lpwLangBuff = msi_alloc(*pcchVersionBuf*sizeof(WCHAR));
if( !lpwLangBuff )
goto end;
}
@ -1190,9 +1177,9 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
lpLangBuf, *pcchLangBuf, NULL, NULL);
end:
HeapFree(GetProcessHeap(), 0, szwFilePath);
HeapFree(GetProcessHeap(), 0, lpwVersionBuff);
HeapFree(GetProcessHeap(), 0, lpwLangBuff);
msi_free(szwFilePath);
msi_free(lpwVersionBuff);
msi_free(lpwLangBuff);
return ret;
}
@ -1222,7 +1209,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
if( !dwVerLen )
return GetLastError();
lpVer = HeapAlloc(GetProcessHeap(), 0, dwVerLen);
lpVer = msi_alloc(dwVerLen);
if( !lpVer )
{
ret = ERROR_OUTOFMEMORY;
@ -1263,7 +1250,7 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
}
end:
HeapFree(GetProcessHeap(), 0, lpVer);
msi_free(lpVer);
return ret;
}
@ -1473,12 +1460,12 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
return ERROR_INDEX_ABSENT;
}
info = HeapAlloc(GetProcessHeap(),0,sz);
info = msi_alloc(sz);
rc = RegQueryValueExW( hkey, szQualifier, NULL, NULL, (LPBYTE)info, &sz);
if (rc != ERROR_SUCCESS)
{
RegCloseKey(hkey);
HeapFree(GetProcessHeap(),0,info);
msi_free(info);
return ERROR_INDEX_ABSENT;
}
@ -1489,7 +1476,7 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
else
{
RegCloseKey(hkey);
HeapFree(GetProcessHeap(),0,info);
msi_free(info);
return ERROR_INDEX_ABSENT;
}
@ -1507,9 +1494,9 @@ UINT WINAPI MsiProvideQualifiedComponentExW(LPCWSTR szComponent,
rc = MsiGetComponentPathW(szProduct, component, lpPathBuf, pcchPathBuf);
RegCloseKey(hkey);
HeapFree(GetProcessHeap(),0,info);
HeapFree(GetProcessHeap(),0,product);
HeapFree(GetProcessHeap(),0,component);
msi_free(info);
msi_free(product);
msi_free(component);
if (rc == INSTALLSTATE_LOCAL)
return ERROR_SUCCESS;
@ -1545,19 +1532,19 @@ UINT WINAPI MsiProvideQualifiedComponentA( LPCSTR szComponent,
szwComponent= strdupAtoW( szComponent);
szwQualifier= strdupAtoW( szQualifier);
lpwPathBuf = HeapAlloc(GetProcessHeap(),0,*pcchPathBuf * sizeof(WCHAR));
lpwPathBuf = msi_alloc(*pcchPathBuf * sizeof(WCHAR));
pcchwPathBuf = *pcchPathBuf;
rc = MsiProvideQualifiedComponentW(szwComponent, szwQualifier,
dwInstallMode, lpwPathBuf, &pcchwPathBuf);
HeapFree(GetProcessHeap(),0,szwComponent);
HeapFree(GetProcessHeap(),0,szwQualifier);
msi_free(szwComponent);
msi_free(szwQualifier);
*pcchPathBuf = WideCharToMultiByte(CP_ACP, 0, lpwPathBuf, pcchwPathBuf,
lpPathBuf, *pcchPathBuf, NULL, NULL);
HeapFree(GetProcessHeap(),0,lpwPathBuf);
msi_free(lpwPathBuf);
return rc;
}
@ -1691,14 +1678,24 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
return rc;
}
UINT WINAPI MsiConfigureFeatureW(LPWSTR szProduct, LPWSTR szFeature, INSTALLSTATE eInstallState)
/***********************************************************************
* MsiConfigureFeatureA [MSI.@]
*/
UINT WINAPI MsiConfigureFeatureA(LPCSTR szProduct, LPCSTR szFeature, INSTALLSTATE eInstallState)
{
FIXME("%s %s %i\n", debugstr_a(szProduct), debugstr_a(szFeature), eInstallState);
return ERROR_SUCCESS;
}
/***********************************************************************
* MsiConfigureFeatureW [MSI.@]
*/
UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLSTATE eInstallState)
{
FIXME("%s %s %i\n", debugstr_w(szProduct), debugstr_w(szFeature), eInstallState);
return ERROR_SUCCESS;
}
UINT WINAPI MsiCreateAndVerifyInstallerDirectory(DWORD dwReserved)
{
WCHAR path[MAX_PATH];
@ -1725,30 +1722,156 @@ UINT WINAPI MsiGetShortcutTargetA( LPCSTR szShortcutTarget,
LPSTR szProductCode, LPSTR szFeatureId,
LPSTR szComponentCode )
{
FIXME("\n");
return ERROR_CALL_NOT_IMPLEMENTED;
LPWSTR target;
const int len = MAX_FEATURE_CHARS+1;
WCHAR product[MAX_FEATURE_CHARS+1], feature[MAX_FEATURE_CHARS+1], component[MAX_FEATURE_CHARS+1];
UINT r;
target = strdupAtoW( szShortcutTarget );
if (szShortcutTarget && !target )
return ERROR_OUTOFMEMORY;
product[0] = 0;
feature[0] = 0;
component[0] = 0;
r = MsiGetShortcutTargetW( target, product, feature, component );
msi_free( target );
if (r == ERROR_SUCCESS)
{
WideCharToMultiByte( CP_ACP, 0, product, -1, szProductCode, len, NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, feature, -1, szFeatureId, len, NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, component, -1, szComponentCode, len, NULL, NULL );
}
return r;
}
UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
LPWSTR szProductCode, LPWSTR szFeatureId,
LPWSTR szComponentCode )
{
FIXME("\n");
FIXME("%s\n", debugstr_w(szShortcutTarget));
return ERROR_CALL_NOT_IMPLEMENTED;
}
UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature,
DWORD dwReinstallMode )
{
MSIPACKAGE* package = NULL;
UINT r;
DWORD sz;
WCHAR sourcepath[MAX_PATH];
WCHAR filename[MAX_PATH];
static const WCHAR szInstalled[] = {
' ','L','O','G','V','E','R','B','O','S','E','=','1',' ','I','n','s','t','a','l','l','e','d','=','1',0};
static const WCHAR fmt[] = {'R','E','I','N','S','T','A','L','L','=','%','s',0};
static const WCHAR REINSTALLMODE[] = {'R','E','I','N','S','T','A','L','L','M','O','D','E',0};
WCHAR reinstallmode[11];
LPWSTR ptr;
LPWSTR commandline;
FIXME("%s %s %li\n", debugstr_w(szProduct), debugstr_w(szFeature),
dwReinstallMode);
return ERROR_SUCCESS;
memset(reinstallmode,0,sizeof(reinstallmode));
ptr = reinstallmode;
if (dwReinstallMode & REINSTALLMODE_FILEMISSING)
{ *ptr = 'p'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_FILEOLDERVERSION)
{ *ptr = 'o'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_FILEEQUALVERSION)
{ *ptr = 'w'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_FILEEXACT)
{ *ptr = 'd'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_FILEVERIFY)
{ *ptr = 'c'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_FILEREPLACE)
{ *ptr = 'a'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_USERDATA)
{ *ptr = 'u'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_MACHINEDATA)
{ *ptr = 'm'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_SHORTCUT)
{ *ptr = 's'; ptr++; }
if (dwReinstallMode & REINSTALLMODE_PACKAGE)
{ *ptr = 'v'; ptr++; }
sz = sizeof(sourcepath);
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath,
&sz);
sz = sizeof(filename);
MsiSourceListGetInfoW(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
strcatW(sourcepath,filename);
if (dwReinstallMode & REINSTALLMODE_PACKAGE)
r = MSI_OpenPackageW( sourcepath, &package );
else
r = MSI_OpenProductW( szProduct, &package );
if (r != ERROR_SUCCESS)
return r;
MSI_SetPropertyW(package,REINSTALLMODE,reinstallmode);
sz = lstrlenW(szInstalled);
sz += lstrlenW(fmt);
sz += lstrlenW(szFeature);
commandline = msi_alloc(sz * sizeof(WCHAR));
sprintfW(commandline,fmt,szFeature);
lstrcatW(commandline,szInstalled);
r = MSI_InstallPackage( package, sourcepath, commandline );
msiobj_release( &package->hdr );
msi_free(commandline);
return r;
}
UINT WINAPI MsiReinstallFeatureA( LPCSTR szProduct, LPCSTR szFeature,
DWORD dwReinstallMode )
{
FIXME("%s %s %li\n", debugstr_a(szProduct), debugstr_a(szFeature),
LPWSTR wszProduct;
LPWSTR wszFeature;
UINT rc;
TRACE("%s %s %li\n", debugstr_a(szProduct), debugstr_a(szFeature),
dwReinstallMode);
return ERROR_SUCCESS;
wszProduct = strdupAtoW(szProduct);
wszFeature = strdupAtoW(szFeature);
rc = MsiReinstallFeatureW(wszProduct, wszFeature, dwReinstallMode);
msi_free(wszProduct);
msi_free(wszFeature);
return rc;
}
/***********************************************************************
* MsiEnumPatchesA [MSI.@]
*/
UINT WINAPI MsiEnumPatchesA( LPCSTR szProduct, DWORD iPatchIndex,
LPSTR lpPatchBuf, LPSTR lpTransformsBuf, DWORD* pcchTransformsBuf)
{
FIXME("%s %ld %p %p %p\n", debugstr_a(szProduct),
iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf);
return ERROR_NO_MORE_ITEMS;
}
/***********************************************************************
* MsiEnumPatchesW [MSI.@]
*/
UINT WINAPI MsiEnumPatchesW( LPCWSTR szProduct, DWORD iPatchIndex,
LPWSTR lpPatchBuf, LPWSTR lpTransformsBuf, DWORD* pcchTransformsBuf)
{
FIXME("%s %ld %p %p %p\n", debugstr_w(szProduct),
iPatchIndex, lpPatchBuf, lpTransformsBuf, pcchTransformsBuf);
return ERROR_NO_MORE_ITEMS;
}

View file

@ -1,36 +1,39 @@
/*
* Resources for MSI
*
* Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "version.rc"
#include "msi_De.rc"
#include "msi_En.rc"
#include "msi_Es.rc"
#include "msi_Fr.rc"
#include "msi_Nl.rc"
#include "msi_Pt.rc"
#include "msi_Ru.rc"
/*
* Resources for MSI
*
* Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "version.rc"
#include "msi_Bg.rc"
#include "msi_De.rc"
#include "msi_En.rc"
#include "msi_Es.rc"
#include "msi_Fi.rc"
#include "msi_Fr.rc"
#include "msi_Nl.rc"
#include "msi_No.rc"
#include "msi_Pt.rc"
#include "msi_Ru.rc"

View file

@ -4,10 +4,10 @@
8 stdcall MsiCloseHandle(long)
9 stdcall MsiCollectUserInfoA(str)
10 stdcall MsiCollectUserInfoW(wstr)
11 stub MsiConfigureFeatureA
11 stdcall MsiConfigureFeatureA(str str long)
12 stub MsiConfigureFeatureFromDescriptorA
13 stub MsiConfigureFeatureFromDescriptorW
14 stdcall MsiConfigureFeatureW(str str ptr)
14 stdcall MsiConfigureFeatureW(wstr wstr ptr)
15 stdcall MsiConfigureProductA(str long long)
16 stdcall MsiConfigureProductW(wstr long long)
17 stdcall MsiCreateRecord(long)
@ -125,8 +125,8 @@
129 stdcall MsiReinstallFeatureW(wstr wstr long)
130 stdcall MsiReinstallProductA(str long)
131 stdcall MsiReinstallProductW(wstr long)
132 stub MsiSequenceA
133 stub MsiSequenceW
132 stdcall MsiSequenceA(long str long)
133 stdcall MsiSequenceW(long wstr long)
134 stdcall MsiSetComponentStateA(long str long)
135 stdcall MsiSetComponentStateW(long wstr long)
136 stdcall MsiSetExternalUIA(ptr long ptr)
@ -173,8 +173,8 @@
177 stub MsiAdvertiseScriptW
178 stub MsiGetPatchInfoA
179 stub MsiGetPatchInfoW
180 stub MsiEnumPatchesA
181 stub MsiEnumPatchesW
180 stdcall MsiEnumPatchesA(str long ptr ptr ptr)
181 stdcall MsiEnumPatchesW(str long ptr ptr ptr)
182 stdcall -private DllGetVersion(ptr)
183 stub MsiGetProductCodeFromPackageCodeA
184 stub MsiGetProductCodeFromPackageCodeW

33
reactos/lib/msi/msi_Bg.rc Normal file
View file

@ -0,0 +1,33 @@
/*
* Bulgarian resources for MSI
*
* Copyright 2005 Milko Krachounov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
5 "ïúòÿò %s íå å íàìåðåí"
9 "ïîñòàâåòå äèñê %s"
10 "íåêîðåêòíè ïàðàìåòðè"
11 "âúâåäåòå ïàïêàòà, êîÿòî ñúäúðæà %s"
12 "èçòî÷íèêà çà èíñòàëàöèÿ íà ôóíêöèîíàëíîñòòà ëèïñâà"
13 "ìðåæîâîòî óñòðîéñòâà íóæíî çà ôóíêöèîíàëíîñòòà ëèïñâà "
14 "ôóíêöèîíàëíîñò îò:"
15 "èçáåðåòå ïàïêàòà, êîÿòî ñúäúðæà %s"
}

View file

@ -1,33 +1,33 @@
/*
* English resources for MSI
*
* Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
5 "path %s not found"
9 "insert disk %s"
10 "bad parameters"
11 "enter which folder contains %s"
12 "install source for feature missing"
13 "network drive for feature missing"
14 "feature from:"
15 "choose which folder contains %s"
}
/*
* English resources for MSI
*
* Copyright 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
5 "path %s not found"
9 "insert disk %s"
10 "bad parameters"
11 "enter which folder contains %s"
12 "install source for feature missing"
13 "network drive for feature missing"
14 "feature from:"
15 "choose which folder contains %s"
}

33
reactos/lib/msi/msi_Fi.rc Normal file
View file

@ -0,0 +1,33 @@
/*
* Finnish resources for MSI
*
* Copyright 2005 Kimmo Myllyvirta
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
5 "Polkua %s ei löydy."
9 "Anna levy %s"
10 "Virheelliset parametrit."
11 "Anna kansio, joka sisältää %s"
12 "Ominaisuuden asennuslähde puuttuu."
13 "Ominaisuuden verkkolevy puuttuu."
14 "Ominaisuus:"
15 "Valitse kansio, joka sisältää %s"
}

33
reactos/lib/msi/msi_No.rc Normal file
View file

@ -0,0 +1,33 @@
/*
* Norwegian Bokmål resources for MSI
*
* Copyright 2005 Alexander N. Sørnes <alex@thehandofagony.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL
STRINGTABLE DISCARDABLE
{
5 "Fant ikke stien '%s'."
9 "Sett i disk '%s'"
10 "Gale parametere."
11 "Oppgi katalogen som inneholder '%s'."
12 "Egenskapens installasjonskilde mangler."
13 "Egenskapens nettverksstasjon mangler."
14 "Egenskap fra::"
15 "Velg katalogen som inneholder '%s'."
}

View file

@ -1,34 +1,34 @@
/*
* Russian resources for MSI
*
* Copyright 2005 Mikhail Y. Zvyozdochkin
* Aleksey Bragin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
5 "ïóòü %s íå íàéäåí"
9 "âñòàâüòå äèñê %s"
10 "íåâåðíûå ïàðàìåòðû"
11 "ââåäèòå, êàêàÿ ïàïêà ñîäåðæèò %s"
12 "íåäîñòóïåí èñòî÷íèê óñòàíîâêè (ñúåìíûé èëè êîìïàêò-äèñê íå âñòàâëåí â äèñêîâîä)"
13 "íåäîñòóïåí ñåòåâîé äèñê, ñîäåðæàùèé íåîáõîäèìûé ôàéë"
14 "ôóíêöèîíàëüíîñòü èç:"
15 "âûáåðèòå, êàêàÿ ïàïêà ñîäåðæèò %s"
}
/*
* Russian resources for MSI
*
* Copyright 2005 Mikhail Y. Zvyozdochkin
* Aleksey Bragin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
5 "ïóòü %s íå íàéäåí"
9 "âñòàâüòå äèñê %s"
10 "íåâåðíûå ïàðàìåòðû"
11 "ââåäèòå, êàêàÿ ïàïêà ñîäåðæèò %s"
12 "íåäîñòóïåí èñòî÷íèê óñòàíîâêè (ñúåìíûé èëè êîìïàêò-äèñê íå âñòàâëåí â äèñêîâîä)"
13 "íåäîñòóïåí ñåòåâîé äèñê, ñîäåðæàùèé íåîáõîäèìûé ôàéë"
14 "ôóíêöèîíàëüíîñòü èç:"
15 "âûáåðèòå, êàêàÿ ïàïêà ñîäåðæèò %s"
}

View file

@ -34,11 +34,12 @@
#define MSI_DATASIZEMASK 0x00ff
#define MSITYPE_VALID 0x0100
#define MSITYPE_LOCALIZABLE 0x200
#define MSITYPE_STRING 0x0800
#define MSITYPE_NULLABLE 0x1000
#define MSITYPE_KEY 0x2000
#define MSITYPE_BINARY 0x8900
#define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID))
struct tagMSITABLE;
typedef struct tagMSITABLE MSITABLE;
@ -57,8 +58,6 @@ struct tagMSIOBJECTHDR
UINT type;
LONG refcount;
msihandledestructor destructor;
struct tagMSIOBJECTHDR *next;
struct tagMSIOBJECTHDR *prev;
};
typedef struct tagMSIDATABASE
@ -67,7 +66,7 @@ typedef struct tagMSIDATABASE
IStorage *storage;
string_table *strings;
LPCWSTR mode;
MSITABLE *first_table, *last_table;
struct list tables;
} MSIDATABASE;
typedef struct tagMSIVIEW MSIVIEW;
@ -188,26 +187,22 @@ typedef struct tagMSIPACKAGE
struct list components;
struct list features;
struct list files;
struct list tempfiles;
struct list folders;
LPWSTR ActionFormat;
LPWSTR LastAction;
struct list classes;
struct list extensions;
struct tagMSIPROGID *progids;
UINT loaded_progids;
struct tagMSIVERB *verbs;
UINT loaded_verbs;
struct list progids;
struct list mimes;
struct list appids;
struct tagMSISCRIPT *script;
struct tagMSIRUNNINGACTION *RunningAction;
UINT RunningActionCount;
struct list RunningActions;
LPWSTR PackagePath;
LPWSTR msiFilePath;
LPWSTR ProductCode;
UINT CurrentInstallState;
@ -241,8 +236,6 @@ typedef struct tagMSIPREVIEW
#define MSIHANDLE_MAGIC 0x4d434923
#define MSIMAXHANDLES 0xf0
#define MSISUMINFO_OFFSET 0x30LL
DEFINE_GUID(CLSID_IMsiServer, 0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
DEFINE_GUID(CLSID_IMsiServerX1, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
DEFINE_GUID(CLSID_IMsiServerX2, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
@ -250,6 +243,21 @@ DEFINE_GUID(CLSID_IMsiServerX3, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x0
DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
typedef struct {
BOOL unicode;
union {
LPSTR a;
LPWSTR w;
} str;
} awstring;
typedef struct {
BOOL unicode;
union {
LPCSTR a;
LPCWSTR w;
} str;
} awcstring;
/* handle functions */
extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
@ -259,16 +267,9 @@ extern void msiobj_addref(MSIOBJECTHDR *);
extern int msiobj_release(MSIOBJECTHDR *);
extern void msiobj_lock(MSIOBJECTHDR *);
extern void msiobj_unlock(MSIOBJECTHDR *);
extern MSIHANDLE msiobj_findhandle( MSIOBJECTHDR *hdr );
/* add this table to the list of cached tables in the database */
extern void add_table(MSIDATABASE *db, MSITABLE *table);
extern void remove_table( MSIDATABASE *db, MSITABLE *table );
extern void free_table( MSIDATABASE *db, MSITABLE *table );
extern void free_cached_tables( MSIDATABASE *db );
extern UINT find_cached_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
extern UINT get_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
extern UINT load_string_table( MSIDATABASE *db );
extern string_table *load_string_table( IStorage *stg );
extern UINT MSI_CommitTables( MSIDATABASE *db );
extern HRESULT init_string_table( IStorage *stg );
@ -300,9 +301,10 @@ extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname,
USHORT **pdata, UINT *psz );
/* action internals */
extern UINT ACTION_DoTopLevelINSTALL( MSIPACKAGE *, LPCWSTR, LPCWSTR, LPCWSTR );
extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern void ACTION_free_package_structures( MSIPACKAGE* );
extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR);
extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode );
/* record internals */
extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *);
@ -379,6 +381,10 @@ extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL cr
extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val );
/* msi dialog interface */
typedef UINT (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog_event_handler );
@ -411,28 +417,55 @@ extern DWORD gUIFilter;
extern LPVOID gUIContext;
extern WCHAR gszLogFile[MAX_PATH];
/* memory allocation macro functions */
static inline void *msi_alloc( size_t len )
{
return HeapAlloc( GetProcessHeap(), 0, len );
}
static inline void *msi_alloc_zero( size_t len )
{
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
}
static inline void *msi_realloc( void *mem, size_t len )
{
return HeapReAlloc( GetProcessHeap(), 0, mem, len );
}
static inline void *msi_realloc_zero( void *mem, size_t len )
{
return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len );
}
static inline BOOL msi_free( void *mem )
{
return HeapFree( GetProcessHeap(), 0, mem );
}
inline static char *strdupWtoA( LPCWSTR str )
{
LPSTR ret = NULL;
if (str)
{
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL
);
if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
}
DWORD len;
if (!str) return ret;
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ret = msi_alloc( len );
if (ret)
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
return ret;
}
inline static LPWSTR strdupAtoW( LPCSTR str )
{
LPWSTR ret = NULL;
if (str)
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
}
DWORD len;
if (!str) return ret;
len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
ret = msi_alloc( len * sizeof(WCHAR) );
if (ret)
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
return ret;
}
@ -440,8 +473,9 @@ inline static LPWSTR strdupW( LPCWSTR src )
{
LPWSTR dest;
if (!src) return NULL;
dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src)+1)*sizeof(WCHAR));
lstrcpyW(dest, src);
dest = msi_alloc( (lstrlenW(src)+1)*sizeof(WCHAR) );
if (dest)
lstrcpyW(dest, src);
return dest;
}

View file

@ -49,7 +49,7 @@ static void MSI_CloseView( MSIOBJECTHDR *arg )
LIST_FOR_EACH_SAFE( ptr, t, &query->mem )
{
HeapFree( GetProcessHeap(), 0, ptr );
msi_free( ptr );
}
}
@ -71,7 +71,7 @@ UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, UINT *n )
if( r != ERROR_SUCCESS )
return r;
x = lstrcmpW( name, col_name );
HeapFree( GetProcessHeap(), 0, col_name );
msi_free( col_name );
if( !x )
{
*n = i;
@ -101,7 +101,7 @@ UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb,
r = MsiDatabaseOpenViewW( hdb, szwQuery, phView);
HeapFree( GetProcessHeap(), 0, szwQuery );
msi_free( szwQuery );
return r;
}
@ -139,62 +139,28 @@ UINT MSI_DatabaseOpenViewW(MSIDATABASE *db,
return r;
}
static UINT MSI_OpenQueryV( MSIDATABASE *db, MSIQUERY **view,
LPCWSTR fmt, va_list args )
{
LPWSTR szQuery;
LPCWSTR p;
UINT sz, rc;
va_list va;
/* figure out how much space we need to allocate */
va = args;
sz = lstrlenW(fmt) + 1;
p = fmt;
while (*p)
{
p = strchrW(p, '%');
if (!p)
break;
p++;
switch (*p)
{
case 's': /* a string */
sz += lstrlenW(va_arg(va,LPCWSTR));
break;
case 'd':
case 'i': /* an integer -2147483648 seems to be longest */
sz += 3*sizeof(int);
(void)va_arg(va,int);
break;
case '%': /* a single % - leave it alone */
break;
default:
FIXME("Unhandled character type %c\n",*p);
}
p++;
}
/* construct the string */
szQuery = HeapAlloc(GetProcessHeap(), 0, sz*sizeof(WCHAR));
va = args;
vsnprintfW(szQuery, sz, fmt, va);
/* perform the query */
rc = MSI_DatabaseOpenViewW(db, szQuery, view);
HeapFree(GetProcessHeap(), 0, szQuery);
return rc;
}
UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
{
UINT r;
va_list va;
va_start(va, fmt);
r = MSI_OpenQueryV( db, view, fmt, va );
va_end(va);
int size = 100, res;
LPWSTR query;
/* construct the string */
for (;;)
{
va_list va;
query = msi_alloc( size*sizeof(WCHAR) );
va_start(va, fmt);
res = vsnprintfW(query, size, fmt, va);
va_end(va);
if (res == -1) size *= 2;
else if (res >= size) size = res + 1;
else break;
msi_free( query );
}
/* perform the query */
r = MSI_DatabaseOpenViewW(db, query, view);
msi_free(query);
return r;
}
@ -217,7 +183,8 @@ UINT MSI_IterateRecords( MSIQUERY *view, DWORD *count,
r = MSI_ViewFetch( view, &rec );
if( r != ERROR_SUCCESS )
break;
r = func( rec, param );
if (func)
r = func( rec, param );
msiobj_release( &rec->hdr );
if( r != ERROR_SUCCESS )
break;
@ -240,11 +207,25 @@ MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... )
MSIRECORD *rec = NULL;
MSIQUERY *view = NULL;
UINT r;
va_list va;
int size = 100, res;
LPWSTR query;
va_start(va, fmt);
r = MSI_OpenQueryV( db, &view, fmt, va );
va_end(va);
/* construct the string */
for (;;)
{
va_list va;
query = msi_alloc( size*sizeof(WCHAR) );
va_start(va, fmt);
res = vsnprintfW(query, size, fmt, va);
va_end(va);
if (res == -1) size *= 2;
else if (res >= size) size = res + 1;
else break;
msi_free( query );
}
/* perform the query */
r = MSI_DatabaseOpenViewW(db, query, &view);
msi_free(query);
if( r == ERROR_SUCCESS )
{
@ -313,8 +294,7 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec)
ERR("Error getting column type for %d\n", i );
continue;
}
if (( type != MSITYPE_BINARY) && (type != (MSITYPE_BINARY |
MSITYPE_NULLABLE)))
if (!MSITYPE_IS_BINARY(type))
{
ret = view->ops->fetch_int( view, query->row, i, &ival );
if( ret )
@ -335,7 +315,7 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec)
sval = MSI_makestring( query->db, ival );
MSI_RecordSetStringW( rec, i, sval );
HeapFree( GetProcessHeap(), 0, sval );
msi_free( sval );
}
else
{
@ -468,6 +448,29 @@ out:
return ret;
}
static UINT msi_set_record_type_string( MSIRECORD *rec, UINT field, UINT type )
{
static const WCHAR fmt[] = { '%','d',0 };
WCHAR szType[0x10];
if (MSITYPE_IS_BINARY(type))
szType[0] = 'v';
else if (type & MSITYPE_LOCALIZABLE)
szType[0] = 'l';
else if (type & MSITYPE_STRING)
szType[0] = 's';
else
szType[0] = 'i';
if (type & MSITYPE_NULLABLE)
szType[0] &= ~0x20;
sprintfW( &szType[1], fmt, (type&0xff) );
TRACE("type %04x -> %s\n", type, debugstr_w(szType) );
return MSI_RecordSetStringW( rec, field, szType );
}
UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hRec)
{
MSIVIEW *view = NULL;
@ -478,6 +481,12 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR
TRACE("%ld %d %p\n", hView, info, hRec);
if( !hRec )
return ERROR_INVALID_PARAMETER;
if( info != MSICOLINFO_NAMES && info != MSICOLINFO_TYPES )
return ERROR_INVALID_PARAMETER;
query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
if( !query )
return ERROR_INVALID_HANDLE;
@ -511,8 +520,11 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR
r = view->ops->get_column_info( view, i+1, &name, &type );
if( r != ERROR_SUCCESS )
continue;
MSI_RecordSetStringW( rec, i+1, name );
HeapFree( GetProcessHeap(), 0, name );
if (info == MSICOLINFO_NAMES)
MSI_RecordSetStringW( rec, i+1, name );
else
msi_set_record_type_string( rec, i+1, type);
msi_free( name );
}
*hRec = alloc_msihandle( &rec->hdr );
@ -627,18 +639,64 @@ MSIDBERROR WINAPI MsiViewGetErrorA( MSIHANDLE handle, LPSTR szColumnNameBuffer,
return r;
}
UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb,
LPCSTR szTransformFile, int iErrorCond)
DEFINE_GUID( CLSID_MsiTransform, 0x000c1082, 0x0000, 0x0000, 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
static UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db,
LPCWSTR szTransformFile, int iErrorCond )
{
FIXME("%ld %s %d\n", hdb, debugstr_a(szTransformFile), iErrorCond);
return ERROR_CALL_NOT_IMPLEMENTED;
UINT r;
IStorage *stg = NULL;
TRACE("%p %s %d\n", db, debugstr_w(szTransformFile), iErrorCond);
r = StgOpenStorage( szTransformFile, NULL,
STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
if( r )
return r;
if( TRACE_ON( msi ) )
enum_stream_names( stg );
/* r = table_apply_transform( db, stg ); */
FIXME("should apply transform %s\n", debugstr_w(szTransformFile) );
IStorage_Release( stg );
return r;
}
UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb,
LPCWSTR szTransformFile, int iErrorCond)
{
FIXME("%ld %s %d\n", hdb, debugstr_w(szTransformFile), iErrorCond);
return ERROR_CALL_NOT_IMPLEMENTED;
MSIDATABASE *db;
UINT r;
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
return ERROR_INVALID_HANDLE;
r = MSI_DatabaseApplyTransformW( db, szTransformFile, iErrorCond );
msiobj_release( &db->hdr );
return r;
}
UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb,
LPCSTR szTransformFile, int iErrorCond)
{
LPWSTR wstr;
UINT ret;
TRACE("%ld %s %d\n", hdb, debugstr_a(szTransformFile), iErrorCond);
wstr = strdupAtoW( szTransformFile );
if( szTransformFile && !wstr )
return ERROR_NOT_ENOUGH_MEMORY;
ret = MsiDatabaseApplyTransformW( hdb, wstr, iErrorCond);
msi_free( wstr );
return ret;
}
UINT WINAPI MsiDatabaseGenerateTransformA( MSIHANDLE hdb, MSIHANDLE hdbref,
@ -785,7 +843,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb,
return ERROR_OUTOFMEMORY;
}
r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec );
HeapFree( GetProcessHeap(), 0, szwTable );
msi_free( szwTable );
return r;
}

View file

@ -160,7 +160,7 @@ static UINT ORDER_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if( r != ERROR_SUCCESS )
return r;
ov->reorder = HeapAlloc( GetProcessHeap(), 0, num_rows*sizeof(UINT) );
ov->reorder = msi_alloc( num_rows*sizeof(UINT) );
if( !ov->reorder )
return ERROR_FUNCTION_FAILED;
@ -187,7 +187,7 @@ static UINT ORDER_close( struct tagMSIVIEW *view )
if( !ov->table )
return ERROR_FUNCTION_FAILED;
HeapFree( GetProcessHeap(), 0, ov->reorder );
msi_free( ov->reorder );
ov->reorder = NULL;
return ov->table->ops->close( ov->table );
@ -240,11 +240,11 @@ static UINT ORDER_delete( struct tagMSIVIEW *view )
if( ov->table )
ov->table->ops->delete( ov->table );
HeapFree( GetProcessHeap(), 0, ov->reorder );
msi_free( ov->reorder );
ov->reorder = NULL;
msiobj_release( &ov->db->hdr );
HeapFree( GetProcessHeap(), 0, ov );
msi_free( ov );
return ERROR_SUCCESS;
}
@ -317,8 +317,7 @@ UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
return r;
}
ov = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof *ov + sizeof (UINT) * count );
ov = msi_alloc_zero( sizeof *ov + sizeof (UINT) * count );
if( !ov )
return ERROR_FUNCTION_FAILED;

View file

@ -380,6 +380,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
list_init( &package->components );
list_init( &package->features );
list_init( &package->files );
list_init( &package->tempfiles );
list_init( &package->folders );
package->ActionFormat = NULL;
package->LastAction = NULL;
@ -390,6 +391,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
list_init( &package->classes );
list_init( &package->mimes );
list_init( &package->extensions );
list_init( &package->progids );
list_init( &package->RunningActions );
/* OK, here is where we do a slew of things to the database to
* prep for all that is to come as a package */
@ -403,6 +406,34 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
return package;
}
/*
* copy_package_to_temp [internal]
*
* copy the msi file to a temp file to prevent locking a CD
* with a multi disc install
*
* FIXME: I think this is wrong, and instead of copying the package,
* we should read all the tables to memory, then open the
* database to read binary streams on demand.
*/
static LPCWSTR copy_package_to_temp( LPCWSTR szPackage, LPWSTR filename )
{
WCHAR path[MAX_PATH];
static const WCHAR szMSI[] = {'M','S','I',0};
GetTempPathW( MAX_PATH, path );
GetTempFileNameW( path, szMSI, 0, filename );
if( !CopyFileW( szPackage, filename, FALSE ) )
{
ERR("failed to copy package to temp path %s\n", debugstr_w(filename) );
return szPackage;
}
TRACE("Opening relocated package %s\n", debugstr_w( filename ));
return filename;
}
UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
{
MSIDATABASE *db = NULL;
@ -410,6 +441,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
MSIHANDLE handle;
DWORD size;
static const WCHAR szProductCode[]= {'P','r','o','d','u','c','t','C','o','d','e',0};
UINT r;
TRACE("%s %p\n", debugstr_w(szPackage), pPackage);
@ -422,7 +454,14 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
}
else
{
UINT r = MSI_OpenDatabaseW(szPackage, MSIDBOPEN_READONLY, &db);
WCHAR temppath[MAX_PATH];
LPCWSTR file = copy_package_to_temp( szPackage, temppath );
r = MSI_OpenDatabaseW( file, MSIDBOPEN_READONLY, &db );
if (file != szPackage)
DeleteFileW( file );
if( r != ERROR_SUCCESS )
return r;
}
@ -451,7 +490,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
size = 0;
MSI_GetPropertyW(package,szProductCode,NULL,&size);
size ++;
package->ProductCode = HeapAlloc(GetProcessHeap(),0,size * sizeof(WCHAR));
package->ProductCode = msi_alloc(size * sizeof(WCHAR));
MSI_GetPropertyW(package,szProductCode,package->ProductCode, &size);
*pPackage = package;
@ -463,40 +502,19 @@ UINT WINAPI MsiOpenPackageExW(LPCWSTR szPackage, DWORD dwOptions, MSIHANDLE *phP
{
MSIPACKAGE *package = NULL;
UINT ret;
WCHAR path[MAX_PATH];
WCHAR filename[MAX_PATH];
static const WCHAR szMSI[] = {'M','S','I',0};
TRACE("%s %08lx %p\n",debugstr_w(szPackage), dwOptions, phPackage);
TRACE("%s %08lx %p\n", debugstr_w(szPackage), dwOptions, phPackage );
/* copy the msi file to a temp file to pervent locking a CD
* with a multi disc install
*/
if( szPackage[0] == '#' )
strcpyW(filename,szPackage);
else
{
GetTempPathW(MAX_PATH, path);
GetTempFileNameW(path, szMSI, 0, filename);
CopyFileW(szPackage, filename, FALSE);
TRACE("Opening relocated package %s\n",debugstr_w(filename));
}
if( dwOptions )
FIXME("dwOptions %08lx not supported\n", dwOptions);
ret = MSI_OpenPackageW( filename, &package);
ret = MSI_OpenPackageW( szPackage, &package );
if( ret == ERROR_SUCCESS )
{
*phPackage = alloc_msihandle( &package->hdr );
msiobj_release( &package->hdr );
}
if( szPackage[0] != '#' )
DeleteFileW(filename);
return ret;
}
@ -519,7 +537,7 @@ UINT WINAPI MsiOpenPackageExA(LPCSTR szPackage, DWORD dwOptions, MSIHANDLE *phPa
ret = MsiOpenPackageExW( szwPack, dwOptions, phPackage );
HeapFree( GetProcessHeap(), 0, szwPack );
msi_free( szwPack );
return ret;
}
@ -580,7 +598,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_PROGRESS)
log_type |= 0x800;
message = HeapAlloc(GetProcessHeap(),0,1*sizeof (WCHAR));
message = msi_alloc(1*sizeof (WCHAR));
message[0]=0;
msg_field = MSI_RecordGetFieldCount(record);
for (i = 1; i <= msg_field; i++)
@ -593,8 +611,8 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
MSI_RecordGetStringW(record,i,NULL,&sz);
sz+=4;
total_size+=sz*sizeof(WCHAR);
tmp = HeapAlloc(GetProcessHeap(),0,sz*sizeof(WCHAR));
message = HeapReAlloc(GetProcessHeap(),0,message,total_size*sizeof (WCHAR));
tmp = msi_alloc(sz*sizeof(WCHAR));
message = msi_realloc(message,total_size*sizeof (WCHAR));
MSI_RecordGetStringW(record,i,tmp,&sz);
@ -607,7 +625,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
if (msg_field > 1)
strcatW(message,space);
HeapFree(GetProcessHeap(),0,tmp);
msi_free(tmp);
}
TRACE("(%p %lx %lx %s)\n",gUIHandlerA, gUIFilter, log_type,
@ -616,7 +634,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
/* convert it to ASCII */
len = WideCharToMultiByte( CP_ACP, 0, message, -1,
NULL, 0, NULL, NULL );
msg = HeapAlloc( GetProcessHeap(), 0, len );
msg = msi_alloc( len );
WideCharToMultiByte( CP_ACP, 0, message, -1,
msg, len, NULL, NULL );
@ -640,9 +658,9 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
CloseHandle(log_file);
}
}
HeapFree( GetProcessHeap(), 0, msg );
msi_free( msg );
HeapFree(GetProcessHeap(),0,message);
msi_free( message);
return ERROR_SUCCESS;
}
@ -694,8 +712,8 @@ UINT WINAPI MsiSetPropertyA( MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue)
hr = MsiSetPropertyW( hInstall, szwName, szwValue);
end:
HeapFree( GetProcessHeap(), 0, szwName );
HeapFree( GetProcessHeap(), 0, szwValue );
msi_free( szwName );
msi_free( szwValue );
return hr;
}
@ -739,19 +757,15 @@ UINT MSI_SetPropertyW( MSIPACKAGE *package, LPCWSTR szName, LPCWSTR szValue)
MSI_RecordSetStringW(row,2,szValue);
}
rc = MSI_DatabaseOpenViewW(package->db,Query,&view);
if (rc!= ERROR_SUCCESS)
if (rc == ERROR_SUCCESS)
{
msiobj_release(&row->hdr);
return rc;
rc = MSI_ViewExecute(view,row);
MSI_ViewClose(view);
msiobj_release(&view->hdr);
}
rc = MSI_ViewExecute(view,row);
msiobj_release(&row->hdr);
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return rc;
}
@ -789,11 +803,11 @@ static UINT MSI_GetPropertyRow(MSIPACKAGE *package, LPCWSTR szName, MSIRECORD **
return ERROR_INVALID_PARAMETER;
sz = sizeof select + strlenW(szName)*sizeof(WCHAR);
query = HeapAlloc(GetProcessHeap(), 0, sz);
query = msi_alloc( sz);
sprintfW(query,select,szName);
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
HeapFree(GetProcessHeap(), 0, query);
msi_free(query);
if (rc == ERROR_SUCCESS)
{
rc = MSI_ViewExecute(view, 0);
@ -874,7 +888,7 @@ UINT MSI_GetPropertyA(MSIPACKAGE *package, LPCSTR szName,
*pchValueBuf = 0;
TRACE("property not found\n");
}
HeapFree( GetProcessHeap(), 0, szwName );
msi_free( szwName );
return rc;
}

View file

@ -145,7 +145,7 @@ UINT WINAPI MsiPreviewDialogA( MSIHANDLE hPreview, LPCSTR szDialogName )
return ERROR_OUTOFMEMORY;
}
r = MsiPreviewDialogW( hPreview, strW );
HeapFree( GetProcessHeap(), 0, strW );
msi_free( strW );
return r;
}

View file

@ -55,7 +55,7 @@ static void MSI_FreeField( MSIFIELD *field )
case MSIFIELD_INT:
break;
case MSIFIELD_WSTR:
HeapFree( GetProcessHeap(), 0, field->u.szwVal);
msi_free( field->u.szwVal);
break;
case MSIFIELD_STREAM:
IStream_Release( field->u.stream );
@ -654,7 +654,7 @@ UINT WINAPI MsiRecordSetStreamA(MSIHANDLE hRecord, unsigned int iField, LPCSTR s
return ERROR_OUTOFMEMORY;
}
ret = MsiRecordSetStreamW(hRecord, iField, wstr);
HeapFree(GetProcessHeap(),0,wstr);
msi_free(wstr);
return ret;
}

View file

@ -581,7 +581,7 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct,
WideCharToMultiByte( CP_ACP, 0, component, MAX_FEATURE_CHARS+1,
szComponent, MAX_FEATURE_CHARS+1, NULL, NULL );
HeapFree( GetProcessHeap(), 0, str );
msi_free( str );
return r;
}
@ -650,7 +650,7 @@ UINT WINAPI MsiEnumFeaturesA(LPCSTR szProduct, DWORD index,
szParent, GUID_SIZE, NULL, NULL);
}
HeapFree( GetProcessHeap(), 0, szwProduct);
msi_free( szwProduct);
return r;
}
@ -730,7 +730,7 @@ UINT WINAPI MsiEnumClientsA(LPCSTR szComponent, DWORD index, LPSTR szProduct)
szProduct, GUID_SIZE, NULL, NULL);
}
HeapFree( GetProcessHeap(), 0, szwComponent);
msi_free( szwComponent);
return r;
}
@ -780,8 +780,7 @@ UINT WINAPI MsiEnumComponentQualifiersA( LPSTR szComponent, DWORD iIndex,
szwComponent = strdupAtoW(szComponent);
if (lpQualifierBuf)
lpwQualifierBuf = HeapAlloc(GetProcessHeap(),0, (*pcchQualifierBuf) *
sizeof(WCHAR));
lpwQualifierBuf = msi_alloc( (*pcchQualifierBuf) * sizeof(WCHAR));
else
lpwQualifierBuf = NULL;
@ -791,8 +790,7 @@ UINT WINAPI MsiEnumComponentQualifiersA( LPSTR szComponent, DWORD iIndex,
pcchwQualifierBuf = 0;
if (lpApplicationDataBuf)
lpwApplicationDataBuf = HeapAlloc(GetProcessHeap(),0 ,
(*pcchApplicationDataBuf) * sizeof(WCHAR));
lpwApplicationDataBuf = msi_alloc( (*pcchApplicationDataBuf) * sizeof(WCHAR));
else
lpwApplicationDataBuf = NULL;
@ -831,9 +829,9 @@ UINT WINAPI MsiEnumComponentQualifiersA( LPSTR szComponent, DWORD iIndex,
*pcchApplicationDataBuf = length - 1;
}
HeapFree(GetProcessHeap(),0,lpwApplicationDataBuf);
HeapFree(GetProcessHeap(),0,lpwQualifierBuf);
HeapFree(GetProcessHeap(),0,szwComponent);
msi_free(lpwApplicationDataBuf);
msi_free(lpwQualifierBuf);
msi_free(szwComponent);
return rc;
}
@ -868,16 +866,16 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
return ERROR_UNKNOWN_COMPONENT;
full_buffer_size = (52 * sizeof(WCHAR)) + actual_pcchApplicationDataBuf;
full_buffer = HeapAlloc(GetProcessHeap(),0,full_buffer_size);
full_buffer = msi_alloc(full_buffer_size);
rc = RegEnumValueW(key, iIndex, lpQualifierBuf, pcchQualifierBuf, NULL,
NULL, (LPBYTE)full_buffer, &full_buffer_size);
if (rc == ERROR_MORE_DATA)
{
HeapFree(GetProcessHeap(),0,full_buffer);
msi_free(full_buffer);
full_buffer_size+=sizeof(WCHAR);
full_buffer = HeapAlloc(GetProcessHeap(),0,full_buffer_size);
full_buffer = msi_alloc(full_buffer_size);
rc = RegEnumValueW(key, iIndex, lpQualifierBuf, pcchQualifierBuf, NULL,
NULL, (LPBYTE)full_buffer, &full_buffer_size);
}
@ -907,7 +905,7 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
debugstr_w(lpApplicationDataBuf));
}
HeapFree(GetProcessHeap(),0,full_buffer);
msi_free(full_buffer);
return rc;
}
@ -971,6 +969,6 @@ UINT WINAPI MsiEnumRelatedProductsA(LPCSTR szUpgradeCode, DWORD dwReserved,
WideCharToMultiByte( CP_ACP, 0, productW, GUID_SIZE,
lpProductBuf, GUID_SIZE, NULL, NULL );
}
HeapFree(GetProcessHeap(), 0, szwUpgradeCode);
msi_free( szwUpgradeCode);
return r;
}

View file

@ -189,8 +189,9 @@ static UINT SELECT_delete( struct tagMSIVIEW *view )
if( sv->table )
sv->table->ops->delete( sv->table );
sv->table = NULL;
HeapFree( GetProcessHeap(), 0, sv );
msi_free( sv );
return ERROR_SUCCESS;
}
@ -259,8 +260,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
return r;
}
sv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof *sv + count*sizeof (UINT) );
sv = msi_alloc_zero( sizeof *sv + count*sizeof (UINT) );
if( !sv )
return ERROR_FUNCTION_FAILED;
@ -279,13 +279,10 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
columns = columns->next;
}
if( r != ERROR_SUCCESS )
{
sv->view.ops->delete( &sv->view );
sv = NULL;
}
*view = &sv->view;
if( r == ERROR_SUCCESS )
*view = &sv->view;
else
msi_free( sv );
return r;
}

View file

@ -129,7 +129,7 @@ static UINT find_given_source(HKEY key, LPCWSTR szSource, media_info *ss)
rc = RegEnumValueW(key, index, szIndex, &size, NULL, NULL, NULL, &val_size);
if (rc != ERROR_NO_MORE_ITEMS)
{
val = HeapAlloc(GetProcessHeap(),0,val_size);
val = msi_alloc(val_size);
RegEnumValueW(key, index, szIndex, &size, NULL, NULL, (LPBYTE)val,
&val_size);
if (lstrcmpiW(szSource,val)==0)
@ -141,7 +141,7 @@ static UINT find_given_source(HKEY key, LPCWSTR szSource, media_info *ss)
else
strcpyW(ss->szIndex,szIndex);
HeapFree(GetProcessHeap(),0,val);
msi_free(val);
index ++;
}
}
@ -221,7 +221,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
else
{
LPWSTR ptr;
buffer = HeapAlloc(GetProcessHeap(),0,size);
buffer = msi_alloc(size);
rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW,
0, 0, (LPBYTE)buffer,&size);
ptr = strchrW(buffer,';');
@ -240,7 +240,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
else
rc = ERROR_SUCCESS;
}
HeapFree(GetProcessHeap(),0,buffer);
msi_free(buffer);
}
}
else if (strcmpW(INSTALLPROPERTY_LASTUSEDTYPEW, szProperty)==0)
@ -254,7 +254,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
rc = ERROR_UNKNOWN_PROPERTY;
else
{
buffer = HeapAlloc(GetProcessHeap(),0,size);
buffer = msi_alloc(size);
rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW,
0, 0, (LPBYTE)buffer,&size);
if (*pcchValue < 1)
@ -267,7 +267,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
szValue[0] = buffer[0];
rc = ERROR_SUCCESS;
}
HeapFree(GetProcessHeap(),0,buffer);
msi_free(buffer);
}
}
else if (strcmpW(INSTALLPROPERTY_PACKAGENAMEW, szProperty)==0)
@ -369,13 +369,13 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
ERR("Unknown source type! 0x%lx\n",dwOptions);
size = (lstrlenW(szValue)+5)*sizeof(WCHAR);
buffer = HeapAlloc(GetProcessHeap(),0,size);
buffer = msi_alloc(size);
sprintfW(buffer, LastUsedSource_Fmt, typechar, 1, szValue);
rc = RegSetValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW, 0,
REG_EXPAND_SZ, (LPBYTE)buffer, size);
if (rc != ERROR_SUCCESS)
rc = ERROR_UNKNOWN_PROPERTY;
HeapFree( GetProcessHeap(), 0, buffer );
msi_free( buffer );
}
else if (strcmpW(INSTALLPROPERTY_PACKAGENAMEW, szProperty)==0)
{
@ -444,7 +444,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
rc = OpenURLSubkey(sourcekey, &typekey, TRUE);
else
{
ERR("Unknown media type!\n");
ERR("unknown media type: %08lx\n", dwOptions);
RegCloseKey(sourcekey);
return ERROR_FUNCTION_FAILED;
}
@ -455,7 +455,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
DWORD current_index = atoiW(source_struct.szIndex);
/* found the source */
if (dwIndex > 0 && current_index != dwIndex)
FIXME("Need to reorder the souces! UNHANDLED\n");
FIXME("Need to reorder the sources!\n");
}
else
{
@ -467,7 +467,7 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
current_index = atoiW(source_struct.szIndex);
/* new source */
if (dwIndex > 0 && dwIndex < current_index)
FIXME("Need to reorder the souces! UNHANDLED\n");
FIXME("Need to reorder the sources!\n");
current_index ++;
sprintfW(source_struct.szIndex,fmt,current_index);
@ -547,11 +547,11 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
size *=sizeof(WCHAR);
buffer = HeapAlloc(GetProcessHeap(),0,size);
buffer = msi_alloc(size);
sprintfW(buffer,disk_fmt,pt1,pt2);
RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size);
HeapFree( GetProcessHeap(), 0, buffer );
msi_free( buffer );
RegCloseKey(sourcekey);
RegCloseKey(mediakey);

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,329 @@
#ifndef BISON_SQL_TAB_H
# define BISON_SQL_TAB_H
/* A Bison parser, made by GNU Bison 1.875c. */
#ifndef YYSTYPE
typedef union
{
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
TK_ABORT = 258,
TK_AFTER = 259,
TK_AGG_FUNCTION = 260,
TK_ALL = 261,
TK_AND = 262,
TK_AS = 263,
TK_ASC = 264,
TK_BEFORE = 265,
TK_BEGIN = 266,
TK_BETWEEN = 267,
TK_BITAND = 268,
TK_BITNOT = 269,
TK_BITOR = 270,
TK_BY = 271,
TK_CASCADE = 272,
TK_CASE = 273,
TK_CHAR = 274,
TK_CHECK = 275,
TK_CLUSTER = 276,
TK_COLLATE = 277,
TK_COLUMN = 278,
TK_COMMA = 279,
TK_COMMENT = 280,
TK_COMMIT = 281,
TK_CONCAT = 282,
TK_CONFLICT = 283,
TK_CONSTRAINT = 284,
TK_COPY = 285,
TK_CREATE = 286,
TK_DEFAULT = 287,
TK_DEFERRABLE = 288,
TK_DEFERRED = 289,
TK_DELETE = 290,
TK_DELIMITERS = 291,
TK_DESC = 292,
TK_DISTINCT = 293,
TK_DOT = 294,
TK_DROP = 295,
TK_EACH = 296,
TK_ELSE = 297,
TK_END = 298,
TK_END_OF_FILE = 299,
TK_EQ = 300,
TK_EXCEPT = 301,
TK_EXPLAIN = 302,
TK_FAIL = 303,
TK_FLOAT = 304,
TK_FOR = 305,
TK_FOREIGN = 306,
TK_FROM = 307,
TK_FUNCTION = 308,
TK_GE = 309,
TK_GLOB = 310,
TK_GROUP = 311,
TK_GT = 312,
TK_HAVING = 313,
TK_HOLD = 314,
TK_IGNORE = 315,
TK_ILLEGAL = 316,
TK_IMMEDIATE = 317,
TK_IN = 318,
TK_INDEX = 319,
TK_INITIALLY = 320,
TK_ID = 321,
TK_INSERT = 322,
TK_INSTEAD = 323,
TK_INT = 324,
TK_INTEGER = 325,
TK_INTERSECT = 326,
TK_INTO = 327,
TK_IS = 328,
TK_ISNULL = 329,
TK_JOIN = 330,
TK_JOIN_KW = 331,
TK_KEY = 332,
TK_LE = 333,
TK_LIKE = 334,
TK_LIMIT = 335,
TK_LONG = 336,
TK_LONGCHAR = 337,
TK_LP = 338,
TK_LSHIFT = 339,
TK_LT = 340,
TK_LOCALIZABLE = 341,
TK_MATCH = 342,
TK_MINUS = 343,
TK_NE = 344,
TK_NOT = 345,
TK_NOTNULL = 346,
TK_NULL = 347,
TK_OBJECT = 348,
TK_OF = 349,
TK_OFFSET = 350,
TK_ON = 351,
TK_OR = 352,
TK_ORACLE_OUTER_JOIN = 353,
TK_ORDER = 354,
TK_PLUS = 355,
TK_PRAGMA = 356,
TK_PRIMARY = 357,
TK_RAISE = 358,
TK_REFERENCES = 359,
TK_REM = 360,
TK_REPLACE = 361,
TK_RESTRICT = 362,
TK_ROLLBACK = 363,
TK_ROW = 364,
TK_RP = 365,
TK_RSHIFT = 366,
TK_SELECT = 367,
TK_SEMI = 368,
TK_SET = 369,
TK_SHORT = 370,
TK_SLASH = 371,
TK_SPACE = 372,
TK_STAR = 373,
TK_STATEMENT = 374,
TK_STRING = 375,
TK_TABLE = 376,
TK_TEMP = 377,
TK_THEN = 378,
TK_TRANSACTION = 379,
TK_TRIGGER = 380,
TK_UMINUS = 381,
TK_UNCLOSED_STRING = 382,
TK_UNION = 383,
TK_UNIQUE = 384,
TK_UPDATE = 385,
TK_UPLUS = 386,
TK_USING = 387,
TK_VACUUM = 388,
TK_VALUES = 389,
TK_VIEW = 390,
TK_WHEN = 391,
TK_WHERE = 392,
TK_WILDCARD = 393,
COLUMN = 395,
FUNCTION = 396,
COMMENT = 397,
UNCLOSED_STRING = 398,
SPACE = 399,
ILLEGAL = 400,
END_OF_FILE = 401
};
#endif
#define TK_ABORT 258
#define TK_AFTER 259
#define TK_AGG_FUNCTION 260
#define TK_ALL 261
#define TK_AND 262
#define TK_AS 263
#define TK_ASC 264
#define TK_BEFORE 265
#define TK_BEGIN 266
#define TK_BETWEEN 267
#define TK_BITAND 268
#define TK_BITNOT 269
#define TK_BITOR 270
#define TK_BY 271
#define TK_CASCADE 272
#define TK_CASE 273
#define TK_CHAR 274
#define TK_CHECK 275
#define TK_CLUSTER 276
#define TK_COLLATE 277
#define TK_COLUMN 278
#define TK_COMMA 279
#define TK_COMMENT 280
#define TK_COMMIT 281
#define TK_CONCAT 282
#define TK_CONFLICT 283
#define TK_CONSTRAINT 284
#define TK_COPY 285
#define TK_CREATE 286
#define TK_DEFAULT 287
#define TK_DEFERRABLE 288
#define TK_DEFERRED 289
#define TK_DELETE 290
#define TK_DELIMITERS 291
#define TK_DESC 292
#define TK_DISTINCT 293
#define TK_DOT 294
#define TK_DROP 295
#define TK_EACH 296
#define TK_ELSE 297
#define TK_END 298
#define TK_END_OF_FILE 299
#define TK_EQ 300
#define TK_EXCEPT 301
#define TK_EXPLAIN 302
#define TK_FAIL 303
#define TK_FLOAT 304
#define TK_FOR 305
#define TK_FOREIGN 306
#define TK_FROM 307
#define TK_FUNCTION 308
#define TK_GE 309
#define TK_GLOB 310
#define TK_GROUP 311
#define TK_GT 312
#define TK_HAVING 313
#define TK_HOLD 314
#define TK_IGNORE 315
#define TK_ILLEGAL 316
#define TK_IMMEDIATE 317
#define TK_IN 318
#define TK_INDEX 319
#define TK_INITIALLY 320
#define TK_ID 321
#define TK_INSERT 322
#define TK_INSTEAD 323
#define TK_INT 324
#define TK_INTEGER 325
#define TK_INTERSECT 326
#define TK_INTO 327
#define TK_IS 328
#define TK_ISNULL 329
#define TK_JOIN 330
#define TK_JOIN_KW 331
#define TK_KEY 332
#define TK_LE 333
#define TK_LIKE 334
#define TK_LIMIT 335
#define TK_LONG 336
#define TK_LONGCHAR 337
#define TK_LP 338
#define TK_LSHIFT 339
#define TK_LT 340
#define TK_LOCALIZABLE 341
#define TK_MATCH 342
#define TK_MINUS 343
#define TK_NE 344
#define TK_NOT 345
#define TK_NOTNULL 346
#define TK_NULL 347
#define TK_OBJECT 348
#define TK_OF 349
#define TK_OFFSET 350
#define TK_ON 351
#define TK_OR 352
#define TK_ORACLE_OUTER_JOIN 353
#define TK_ORDER 354
#define TK_PLUS 355
#define TK_PRAGMA 356
#define TK_PRIMARY 357
#define TK_RAISE 358
#define TK_REFERENCES 359
#define TK_REM 360
#define TK_REPLACE 361
#define TK_RESTRICT 362
#define TK_ROLLBACK 363
#define TK_ROW 364
#define TK_RP 365
#define TK_RSHIFT 366
#define TK_SELECT 367
#define TK_SEMI 368
#define TK_SET 369
#define TK_SHORT 370
#define TK_SLASH 371
#define TK_SPACE 372
#define TK_STAR 373
#define TK_STATEMENT 374
#define TK_STRING 375
#define TK_TABLE 376
#define TK_TEMP 377
#define TK_THEN 378
#define TK_TRANSACTION 379
#define TK_TRIGGER 380
#define TK_UMINUS 381
#define TK_UNCLOSED_STRING 382
#define TK_UNION 383
#define TK_UNIQUE 384
#define TK_UPDATE 385
#define TK_UPLUS 386
#define TK_USING 387
#define TK_VACUUM 388
#define TK_VALUES 389
#define TK_VIEW 390
#define TK_WHEN 391
#define TK_WHERE 392
#define TK_WILDCARD 393
#define COLUMN 395
#define FUNCTION 396
#define COMMENT 397
#define UNCLOSED_STRING 398
#define SPACE 399
#define ILLEGAL 400
#define END_OF_FILE 401
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 72 "./sql.y"
typedef union YYSTYPE {
struct sql_str str;
LPWSTR string;
column_info *column_list;
@ -11,153 +331,15 @@ typedef union
struct expr *expr;
USHORT column_type;
int integer;
} yystype;
# define YYSTYPE yystype
} YYSTYPE;
/* Line 1275 of yacc.c. */
#line 337 "sql.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
# define TK_ABORT 257
# define TK_AFTER 258
# define TK_AGG_FUNCTION 259
# define TK_ALL 260
# define TK_AND 261
# define TK_AS 262
# define TK_ASC 263
# define TK_BEFORE 264
# define TK_BEGIN 265
# define TK_BETWEEN 266
# define TK_BITAND 267
# define TK_BITNOT 268
# define TK_BITOR 269
# define TK_BY 270
# define TK_CASCADE 271
# define TK_CASE 272
# define TK_CHAR 273
# define TK_CHECK 274
# define TK_CLUSTER 275
# define TK_COLLATE 276
# define TK_COLUMN 277
# define TK_COMMA 278
# define TK_COMMENT 279
# define TK_COMMIT 280
# define TK_CONCAT 281
# define TK_CONFLICT 282
# define TK_CONSTRAINT 283
# define TK_COPY 284
# define TK_CREATE 285
# define TK_DEFAULT 286
# define TK_DEFERRABLE 287
# define TK_DEFERRED 288
# define TK_DELETE 289
# define TK_DELIMITERS 290
# define TK_DESC 291
# define TK_DISTINCT 292
# define TK_DOT 293
# define TK_DROP 294
# define TK_EACH 295
# define TK_ELSE 296
# define TK_END 297
# define TK_END_OF_FILE 298
# define TK_EQ 299
# define TK_EXCEPT 300
# define TK_EXPLAIN 301
# define TK_FAIL 302
# define TK_FLOAT 303
# define TK_FOR 304
# define TK_FOREIGN 305
# define TK_FROM 306
# define TK_FUNCTION 307
# define TK_GE 308
# define TK_GLOB 309
# define TK_GROUP 310
# define TK_GT 311
# define TK_HAVING 312
# define TK_HOLD 313
# define TK_IGNORE 314
# define TK_ILLEGAL 315
# define TK_IMMEDIATE 316
# define TK_IN 317
# define TK_INDEX 318
# define TK_INITIALLY 319
# define TK_ID 320
# define TK_INSERT 321
# define TK_INSTEAD 322
# define TK_INT 323
# define TK_INTEGER 324
# define TK_INTERSECT 325
# define TK_INTO 326
# define TK_IS 327
# define TK_ISNULL 328
# define TK_JOIN 329
# define TK_JOIN_KW 330
# define TK_KEY 331
# define TK_LE 332
# define TK_LIKE 333
# define TK_LIMIT 334
# define TK_LONG 335
# define TK_LONGCHAR 336
# define TK_LP 337
# define TK_LSHIFT 338
# define TK_LT 339
# define TK_LOCALIZABLE 340
# define TK_MATCH 341
# define TK_MINUS 342
# define TK_NE 343
# define TK_NOT 344
# define TK_NOTNULL 345
# define TK_NULL 346
# define TK_OBJECT 347
# define TK_OF 348
# define TK_OFFSET 349
# define TK_ON 350
# define TK_OR 351
# define TK_ORACLE_OUTER_JOIN 352
# define TK_ORDER 353
# define TK_PLUS 354
# define TK_PRAGMA 355
# define TK_PRIMARY 356
# define TK_RAISE 357
# define TK_REFERENCES 358
# define TK_REM 359
# define TK_REPLACE 360
# define TK_RESTRICT 361
# define TK_ROLLBACK 362
# define TK_ROW 363
# define TK_RP 364
# define TK_RSHIFT 365
# define TK_SELECT 366
# define TK_SEMI 367
# define TK_SET 368
# define TK_SHORT 369
# define TK_SLASH 370
# define TK_SPACE 371
# define TK_STAR 372
# define TK_STATEMENT 373
# define TK_STRING 374
# define TK_TABLE 375
# define TK_TEMP 376
# define TK_THEN 377
# define TK_TRANSACTION 378
# define TK_TRIGGER 379
# define TK_UMINUS 380
# define TK_UNCLOSED_STRING 381
# define TK_UNION 382
# define TK_UNIQUE 383
# define TK_UPDATE 384
# define TK_UPLUS 385
# define TK_USING 386
# define TK_VACUUM 387
# define TK_VALUES 388
# define TK_VIEW 389
# define TK_WHEN 390
# define TK_WHERE 391
# define TK_WILDCARD 392
# define END_OF_FILE 393
# define ILLEGAL 394
# define SPACE 395
# define UNCLOSED_STRING 396
# define COMMENT 397
# define FUNCTION 398
# define COLUMN 399
#endif /* not BISON_SQL_TAB_H */

File diff suppressed because it is too large Load diff

View file

@ -72,18 +72,17 @@ string_table *msi_init_stringtable( int entries, UINT codepage )
{
string_table *st;
st = HeapAlloc( GetProcessHeap(), 0, sizeof (string_table) );
st = msi_alloc( sizeof (string_table) );
if( !st )
return NULL;
st->strings = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof (msistring) * entries );
if( !st )
{
HeapFree( GetProcessHeap(), 0, st );
return NULL;
}
if( entries < 1 )
entries = 1;
st->strings = msi_alloc_zero( sizeof (msistring) * entries );
if( !st )
{
msi_free( st );
return NULL;
}
st->maxcount = entries;
st->freeslot = 1;
st->codepage = codepage;
@ -98,10 +97,10 @@ VOID msi_destroy_stringtable( string_table *st )
for( i=0; i<st->maxcount; i++ )
{
if( st->strings[i].refcount )
HeapFree( GetProcessHeap(), 0, st->strings[i].str );
msi_free( st->strings[i].str );
}
HeapFree( GetProcessHeap(), 0, st->strings );
HeapFree( GetProcessHeap(), 0, st );
msi_free( st->strings );
msi_free( st );
}
static int st_find_free_entry( string_table *st )
@ -123,8 +122,7 @@ static int st_find_free_entry( string_table *st )
/* dynamically resize */
sz = st->maxcount + 1 + st->maxcount/2;
p = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
st->strings, sz*sizeof(msistring) );
p = msi_realloc_zero( st->strings, sz*sizeof(msistring) );
if( !p )
return -1;
st->strings = p;
@ -177,7 +175,7 @@ int msi_addstring( string_table *st, UINT n, const CHAR *data, int len, UINT ref
if( len < 0 )
len = strlen(data);
sz = MultiByteToWideChar( st->codepage, 0, data, len, NULL, 0 );
st->strings[n].str = HeapAlloc( GetProcessHeap(), 0, (sz+1)*sizeof(WCHAR) );
st->strings[n].str = msi_alloc( (sz+1)*sizeof(WCHAR) );
if( !st->strings[n].str )
return -1;
MultiByteToWideChar( st->codepage, 0, data, len, st->strings[n].str, sz );
@ -226,7 +224,7 @@ int msi_addstringW( string_table *st, UINT n, const WCHAR *data, int len, UINT r
len = strlenW(data);
TRACE("%s, n = %d len = %d\n", debugstr_w(data), n, len );
st->strings[n].str = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) );
st->strings[n].str = msi_alloc( (len+1)*sizeof(WCHAR) );
if( !st->strings[n].str )
return -1;
TRACE("%d\n",__LINE__);
@ -387,13 +385,13 @@ UINT msi_string2idA( string_table *st, LPCSTR buffer, UINT *id )
sz = MultiByteToWideChar( st->codepage, 0, buffer, -1, NULL, 0 );
if( sz <= 0 )
return r;
str = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
str = msi_alloc( sz*sizeof(WCHAR) );
if( !str )
return ERROR_NOT_ENOUGH_MEMORY;
MultiByteToWideChar( st->codepage, 0, buffer, -1, str, sz );
r = msi_string2idW( st, str, id );
HeapFree( GetProcessHeap(), 0, str );
msi_free( str );
return r;
}

View file

@ -83,22 +83,6 @@ typedef struct {
#define SECT_HDR_SIZE (sizeof(PROPERTYSECTIONHEADER))
typedef struct {
BOOL unicode;
union {
LPSTR a;
LPWSTR w;
} str;
} awstring;
typedef struct {
BOOL unicode;
union {
LPCSTR a;
LPCWSTR w;
} str;
} awcstring;
typedef struct tagMSISUMMARYINFO
{
MSIOBJECTHDR hdr;
@ -113,7 +97,7 @@ static const WCHAR szSumInfo[] = { 5 ,'S','u','m','m','a','r','y',
static void free_prop( PROPVARIANT *prop )
{
if (prop->vt == VT_LPSTR )
HeapFree( GetProcessHeap(), 0, prop->u.pszVal );
msi_free( prop->u.pszVal );
prop->vt = VT_EMPTY;
}
@ -225,7 +209,7 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz
if( type == VT_LPSTR )
{
LPSTR str = HeapAlloc( GetProcessHeap(), 0, propdata->u.str.len );
LPSTR str = msi_alloc( propdata->u.str.len );
memcpy( str, propdata->u.str.str, propdata->u.str.len );
str[ propdata->u.str.len - 1 ] = 0;
property->u.pszVal = str;
@ -291,7 +275,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm )
return ret;
}
data = HeapAlloc( GetProcessHeap(), 0, section_hdr.cbSection);
data = msi_alloc( section_hdr.cbSection);
if( !data )
return ret;
@ -305,7 +289,7 @@ static UINT load_summary_info( MSISUMMARYINFO *si, IStream *stm )
else
ERR("failed to read properties %ld %ld\n", count, sz);
HeapFree( GetProcessHeap(), 0, data );
msi_free( data );
return ret;
}
@ -412,7 +396,7 @@ static UINT save_summary_info( MSISUMMARYINFO * si, IStream *stm )
section_hdr.cbSection += sz;
}
data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, section_hdr.cbSection );
data = msi_alloc_zero( section_hdr.cbSection );
sz = 0;
memcpy( &data[sz], &section_hdr, sizeof section_hdr );
@ -426,7 +410,7 @@ static UINT save_summary_info( MSISUMMARYINFO * si, IStream *stm )
sz += write_property_to_data( &si->property[i], &data[sz] );
r = IStream_Write( stm, data, sz, &count );
HeapFree( GetProcessHeap(), 0, data );
msi_free( data );
if( FAILED(r) || count != sz )
return ret;
@ -519,7 +503,7 @@ UINT WINAPI MsiGetSummaryInformationA(MSIHANDLE hDatabase,
ret = MsiGetSummaryInformationW(hDatabase, szwDatabase, uiUpdateCount, pHandle);
HeapFree( GetProcessHeap(), 0, szwDatabase );
msi_free( szwDatabase );
return ret;
}
@ -546,6 +530,7 @@ static UINT get_prop( MSIHANDLE handle, UINT uiProperty, UINT *puiDataType,
{
MSISUMMARYINFO *si;
PROPVARIANT *prop;
UINT ret = ERROR_SUCCESS;
TRACE("%ld %d %p %p %p %p %p\n", handle, uiProperty, puiDataType,
piValue, pftValue, str, pcchValueBuf);
@ -578,6 +563,7 @@ static UINT get_prop( MSIHANDLE handle, UINT uiProperty, UINT *puiDataType,
{
len = MultiByteToWideChar( CP_ACP, 0, prop->u.pszVal, -1,
str->str.w, *pcchValueBuf );
len--;
}
else
{
@ -585,6 +571,8 @@ static UINT get_prop( MSIHANDLE handle, UINT uiProperty, UINT *puiDataType,
if( str->str.a )
lstrcpynA(str->str.a, prop->u.pszVal, *pcchValueBuf );
}
if (len >= *pcchValueBuf)
ret = ERROR_MORE_DATA;
*pcchValueBuf = len;
}
break;
@ -599,7 +587,7 @@ static UINT get_prop( MSIHANDLE handle, UINT uiProperty, UINT *puiDataType,
break;
}
msiobj_release( &si->hdr );
return ERROR_SUCCESS;
return ret;
}
UINT WINAPI MsiSummaryInfoGetPropertyA(
@ -690,14 +678,14 @@ static UINT set_prop( MSIHANDLE handle, UINT uiProperty, UINT uiDataType,
{
len = WideCharToMultiByte( CP_ACP, 0, str->str.w, -1,
NULL, 0, NULL, NULL );
prop->u.pszVal = HeapAlloc( GetProcessHeap(), 0, len );
prop->u.pszVal = msi_alloc( len );
WideCharToMultiByte( CP_ACP, 0, str->str.w, -1,
prop->u.pszVal, len, NULL, NULL );
}
else
{
len = lstrlenA( str->str.a ) + 1;
prop->u.pszVal = HeapAlloc( GetProcessHeap(), 0, len );
prop->u.pszVal = msi_alloc( len );
lstrcpyA( prop->u.pszVal, str->str.a );
}
break;

View file

@ -1,7 +1,7 @@
/*
* Implementation of the Microsoft Installer (msi.dll)
*
* Copyright 2002-2004 Mike McCormack for CodeWeavers
* Copyright 2002-2005 Mike McCormack for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -41,9 +41,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
typedef struct tagMSICOLUMNINFO
{
LPWSTR tablename;
LPCWSTR tablename;
UINT number;
LPWSTR colname;
LPCWSTR colname;
UINT type;
UINT offset;
} MSICOLUMNINFO;
@ -51,10 +51,8 @@ typedef struct tagMSICOLUMNINFO
struct tagMSITABLE
{
USHORT **data;
UINT ref_count;
UINT row_count;
struct tagMSITABLE *next;
struct tagMSITABLE *prev;
struct list entry;
WCHAR name[1];
};
@ -64,8 +62,9 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name,
MSICOLUMNINFO **pcols, UINT *pcount );
static UINT get_tablecolumns( MSIDATABASE *db,
LPCWSTR szTableName, MSICOLUMNINFO *colinfo, UINT *sz);
static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count );
static inline UINT bytes_per_column( MSICOLUMNINFO *col )
static inline UINT bytes_per_column( const MSICOLUMNINFO *col )
{
if( col->type & MSITYPE_STRING )
return 2;
@ -97,7 +96,7 @@ static LPWSTR encode_streamname(BOOL bTable, LPCWSTR in)
if( !bTable )
count = lstrlenW( in )+2;
out = HeapAlloc( GetProcessHeap(), 0, count*sizeof(WCHAR) );
out = msi_alloc( count*sizeof(WCHAR) );
p = out;
if( bTable )
@ -131,7 +130,7 @@ static LPWSTR encode_streamname(BOOL bTable, LPCWSTR in)
*p++ = ch;
}
ERR("Failed to encode stream name (%s)\n",debugstr_w(in));
HeapFree( GetProcessHeap(), 0, out );
msi_free( out );
return NULL;
}
@ -219,7 +218,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
r = IStorage_OpenStream(stg, encname, NULL,
STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm);
HeapFree( GetProcessHeap(), 0, encname );
msi_free( encname );
if( FAILED( r ) )
{
WARN("open stream failed r = %08lx - empty table?\n",r);
@ -240,7 +239,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
}
sz = stat.cbSize.QuadPart;
data = HeapAlloc( GetProcessHeap(), 0, sz );
data = msi_alloc( sz );
if( !data )
{
WARN("couldn't allocate memory r=%08lx!\n",r);
@ -251,7 +250,7 @@ static UINT read_stream_data( IStorage *stg, LPCWSTR stname,
r = IStream_Read(stm, data, sz, &count );
if( FAILED( r ) || ( count != sz ) )
{
HeapFree( GetProcessHeap(), 0, data );
msi_free( data );
WARN("read stream failed r = %08lx!\n",r);
goto end;
}
@ -277,7 +276,7 @@ UINT db_get_raw_stream( MSIDATABASE *db, LPCWSTR stname, IStream **stm )
r = IStorage_OpenStream(db->storage, encname, NULL,
STGM_READ | STGM_SHARE_EXCLUSIVE, 0, stm);
HeapFree( GetProcessHeap(), 0, encname );
msi_free( encname );
if( FAILED( r ) )
{
WARN("open stream failed r = %08lx - empty table?\n",r);
@ -314,7 +313,7 @@ UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
}
sz = stat.cbSize.QuadPart;
data = HeapAlloc( GetProcessHeap(), 0, sz );
data = msi_alloc( sz );
if( !data )
{
WARN("couldn't allocate memory r=%08lx!\n",r);
@ -325,7 +324,7 @@ UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
r = IStream_Read(stm, data, sz, &count );
if( FAILED( r ) || ( count != sz ) )
{
HeapFree( GetProcessHeap(), 0, data );
msi_free( data );
WARN("read stream failed r = %08lx!\n",r);
goto end;
}
@ -359,7 +358,7 @@ static UINT write_stream_data( IStorage *stg, LPCWSTR stname,
r = IStorage_CreateStream( stg, encname,
STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
}
HeapFree( GetProcessHeap(), 0, encname );
msi_free( encname );
if( FAILED( r ) )
{
WARN("open stream failed r = %08lx\n",r);
@ -397,62 +396,70 @@ end:
return ret;
}
static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **ptable)
static void free_table( MSITABLE *table )
{
int i;
for( i=0; i<table->row_count; i++ )
msi_free( table->data[i] );
msi_free( table->data );
msi_free( table );
}
static UINT msi_table_get_row_size( const MSICOLUMNINFO *cols, UINT count )
{
const MSICOLUMNINFO *last_col = &cols[count-1];
if (!count)
return 0;
return last_col->offset + bytes_per_column( last_col );
}
/* add this table to the list of cached tables in the database */
static MSITABLE *read_table_from_storage( IStorage *stg, LPCWSTR name,
const MSICOLUMNINFO *cols, UINT num_cols )
{
MSITABLE *t;
USHORT *rawdata = NULL;
UINT rawsize = 0, r, i, j, row_size = 0, num_cols = 0;
MSICOLUMNINFO *cols, *last_col;
UINT rawsize = 0, i, j, row_size = 0;
TRACE("%s\n",debugstr_w(name));
/* nonexistent tables should be interpreted as empty tables */
t = HeapAlloc( GetProcessHeap(), 0,
sizeof (MSITABLE) + lstrlenW(name)*sizeof (WCHAR) );
t = msi_alloc( sizeof (MSITABLE) + lstrlenW(name)*sizeof (WCHAR) );
if( !t )
return ERROR_NOT_ENOUGH_MEMORY;
return t;
r = table_get_column_info( db, name, &cols, &num_cols );
if( r != ERROR_SUCCESS )
{
HeapFree( GetProcessHeap(), 0, t );
return r;
}
last_col = &cols[num_cols-1];
row_size = last_col->offset + bytes_per_column( last_col );
row_size = msi_table_get_row_size( cols, num_cols );
t->row_count = 0;
t->data = NULL;
lstrcpyW( t->name, name );
t->ref_count = 1;
*ptable = t;
/* if we can't read the table, just assume that it's empty */
read_stream_data( db->storage, name, &rawdata, &rawsize );
read_stream_data( stg, name, &rawdata, &rawsize );
if( !rawdata )
return ERROR_SUCCESS;
return t;
TRACE("Read %d bytes\n", rawsize );
if( rawsize % row_size )
{
WARN("Table size is invalid %d/%d\n", rawsize, row_size );
return ERROR_FUNCTION_FAILED;
goto err;
}
t->row_count = rawsize / row_size;
t->data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
t->row_count * sizeof (USHORT*) );
t->data = msi_alloc_zero( t->row_count * sizeof (USHORT*) );
if( !t->data )
return ERROR_NOT_ENOUGH_MEMORY; /* FIXME: memory leak */
goto err;
/* transpose all the data */
TRACE("Transposing data from %d columns\n", t->row_count );
for( i=0; i<t->row_count; i++ )
{
t->data[i] = HeapAlloc( GetProcessHeap(), 0, row_size );
t->data[i] = msi_alloc( row_size );
if( !t->data[i] )
return ERROR_NOT_ENOUGH_MEMORY; /* FIXME: memory leak */
goto err;
for( j=0; j<num_cols; j++ )
{
UINT ofs = cols[j].offset/2;
@ -469,91 +476,44 @@ static UINT read_table_from_storage( MSIDATABASE *db, LPCWSTR name, MSITABLE **p
break;
default:
ERR("oops - unknown column width %d\n", n);
return ERROR_FUNCTION_FAILED;
goto err;
}
}
}
HeapFree( GetProcessHeap(), 0, cols );
HeapFree( GetProcessHeap(), 0, rawdata );
return ERROR_SUCCESS;
}
/* add this table to the list of cached tables in the database */
void add_table(MSIDATABASE *db, MSITABLE *table)
{
table->next = db->first_table;
table->prev = NULL;
if( db->first_table )
db->first_table->prev = table;
else
db->last_table = table;
db->first_table = table;
}
/* remove from the list of cached tables */
void remove_table( MSIDATABASE *db, MSITABLE *table )
{
if( table->next )
table->next->prev = table->prev;
else
db->last_table = table->prev;
if( table->prev )
table->prev->next = table->next;
else
db->first_table = table->next;
table->next = NULL;
table->prev = NULL;
}
static void release_table( MSIDATABASE *db, MSITABLE *table )
{
if( !table->ref_count )
ERR("Trying to destroy table with refcount 0\n");
table->ref_count --;
if( !table->ref_count )
{
remove_table( db, table );
HeapFree( GetProcessHeap(), 0, table->data );
HeapFree( GetProcessHeap(), 0, table );
TRACE("Destroyed table %s\n", debugstr_w(table->name));
}
msi_free( rawdata );
return t;
err:
msi_free( rawdata );
free_table( t );
return NULL;
}
void free_cached_tables( MSIDATABASE *db )
{
while( db->first_table )
while( !list_empty( &db->tables ) )
{
MSITABLE *t = db->first_table;
MSITABLE *t = LIST_ENTRY( list_head( &db->tables ), MSITABLE, entry );
if ( --t->ref_count )
ERR("table ref count not zero for %s\n", debugstr_w(t->name));
remove_table( db, t );
HeapFree( GetProcessHeap(), 0, t->data );
HeapFree( GetProcessHeap(), 0, t );
list_remove( &t->entry );
free_table( t );
}
}
UINT find_cached_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **ptable)
static MSITABLE *find_cached_table( MSIDATABASE *db, LPCWSTR name )
{
MSITABLE *t;
for( t = db->first_table; t; t=t->next )
{
LIST_FOR_EACH_ENTRY( t, &db->tables, MSITABLE, entry )
if( !lstrcmpW( name, t->name ) )
{
*ptable = t;
return ERROR_SUCCESS;
}
}
return t;
return ERROR_FUNCTION_FAILED;
return NULL;
}
static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO **pcols, UINT *pcount )
{
UINT r, column_count;
UINT r, column_count = 0;
MSICOLUMNINFO *columns;
/* get the number of columns in this table */
@ -568,14 +528,14 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO
TRACE("Table %s found\n", debugstr_w(name) );
columns = HeapAlloc( GetProcessHeap(), 0, column_count*sizeof (MSICOLUMNINFO));
columns = msi_alloc( column_count*sizeof (MSICOLUMNINFO) );
if( !columns )
return ERROR_FUNCTION_FAILED;
r = get_tablecolumns( db, name, columns, &column_count );
if( r != ERROR_SUCCESS )
{
HeapFree( GetProcessHeap(), 0, columns );
msi_free( columns );
return ERROR_FUNCTION_FAILED;
}
@ -585,36 +545,28 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO
return r;
}
UINT get_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **ptable)
static MSITABLE *get_table( MSIDATABASE *db, LPCWSTR name,
const MSICOLUMNINFO *cols, UINT num_cols )
{
UINT r;
*ptable = NULL;
MSITABLE *table;
/* first, see if the table is cached */
r = find_cached_table( db, name, ptable );
if( r == ERROR_SUCCESS )
{
(*ptable)->ref_count++;
return r;
}
table = find_cached_table( db, name );
if( table )
return table;
r = read_table_from_storage( db, name, ptable );
if( r != ERROR_SUCCESS )
return r;
table = read_table_from_storage( db->storage, name, cols, num_cols );
if( table )
list_add_head( &db->tables, &table->entry );
/* add the table to the list */
add_table( db, *ptable );
(*ptable)->ref_count++;
return ERROR_SUCCESS;
return table;
}
static UINT save_table( MSIDATABASE *db, MSITABLE *t )
{
USHORT *rawdata = NULL, *p;
UINT rawsize, r, i, j, row_size, num_cols = 0;
MSICOLUMNINFO *cols, *last_col;
MSICOLUMNINFO *cols = NULL;
TRACE("Saving %s\n", debugstr_w( t->name ) );
@ -622,13 +574,15 @@ static UINT save_table( MSIDATABASE *db, MSITABLE *t )
if( r != ERROR_SUCCESS )
return r;
last_col = &cols[num_cols-1];
row_size = last_col->offset + bytes_per_column( last_col );
row_size = msi_table_get_row_size( cols, num_cols );
rawsize = t->row_count * row_size;
rawdata = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, rawsize );
rawdata = msi_alloc_zero( rawsize );
if( !rawdata )
return ERROR_NOT_ENOUGH_MEMORY;
{
r = ERROR_NOT_ENOUGH_MEMORY;
goto err;
}
p = rawdata;
for( i=0; i<num_cols; i++ )
@ -646,7 +600,10 @@ static UINT save_table( MSIDATABASE *db, MSITABLE *t )
TRACE("writing %d bytes\n", rawsize);
r = write_stream_data( db->storage, t->name, rawdata, rawsize );
HeapFree( GetProcessHeap(), 0, rawdata );
err:
msi_free_colinfo( cols, num_cols );
msi_free( cols );
msi_free( rawdata );
return r;
}
@ -668,7 +625,7 @@ HRESULT init_string_table( IStorage *stg )
/* create the StringPool stream... add the zero string to it*/
r = IStorage_CreateStream( stg, encname,
STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
HeapFree( GetProcessHeap(), 0, encname );
msi_free( encname );
if( r )
{
TRACE("Failed\n");
@ -688,7 +645,7 @@ HRESULT init_string_table( IStorage *stg )
encname = encode_streamname(TRUE, szStringData );
r = IStorage_CreateStream( stg, encname,
STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
HeapFree( GetProcessHeap(), 0, encname );
msi_free( encname );
if( r )
{
TRACE("Failed\n");
@ -699,27 +656,22 @@ HRESULT init_string_table( IStorage *stg )
return r;
}
UINT load_string_table( MSIDATABASE *db )
string_table *load_string_table( IStorage *stg )
{
string_table *st = NULL;
CHAR *data;
USHORT *pool;
UINT r, ret = ERROR_FUNCTION_FAILED, datasize = 0, poolsize = 0, codepage;
UINT r, datasize = 0, poolsize = 0, codepage;
DWORD i, count, offset, len, n;
static const WCHAR szStringData[] = {
'_','S','t','r','i','n','g','D','a','t','a',0 };
static const WCHAR szStringPool[] = {
'_','S','t','r','i','n','g','P','o','o','l',0 };
if( db->strings )
{
msi_destroy_stringtable( db->strings );
db->strings = NULL;
}
r = read_stream_data( db->storage, szStringPool, &pool, &poolsize );
r = read_stream_data( stg, szStringPool, &pool, &poolsize );
if( r != ERROR_SUCCESS)
goto end;
r = read_stream_data( db->storage, szStringData, (USHORT**)&data, &datasize );
r = read_stream_data( stg, szStringData, (USHORT**)&data, &datasize );
if( r != ERROR_SUCCESS)
goto end;
@ -728,7 +680,7 @@ UINT load_string_table( MSIDATABASE *db )
codepage = pool[0] | ( pool[1] << 16 );
else
codepage = CP_ACP;
db->strings = msi_init_stringtable( count, codepage );
st = msi_init_stringtable( count, codepage );
offset = 0;
n = 1;
@ -753,7 +705,7 @@ UINT load_string_table( MSIDATABASE *db )
/* don't add the high word of a string's length as a string */
if ( len || !pool[i*2+1] )
{
r = msi_addstring( db->strings, n, data+offset, len, pool[i*2+1] );
r = msi_addstring( st, n, data+offset, len, pool[i*2+1] );
if( r != n )
ERR("Failed to add string %ld\n", n );
n++;
@ -767,13 +719,11 @@ UINT load_string_table( MSIDATABASE *db )
TRACE("Loaded %ld strings\n", count);
ret = ERROR_SUCCESS;
end:
HeapFree( GetProcessHeap(), 0, pool );
HeapFree( GetProcessHeap(), 0, data );
msi_free( pool );
msi_free( data );
return ret;
return st;
}
static UINT save_string_table( MSIDATABASE *db )
@ -793,13 +743,13 @@ static UINT save_string_table( MSIDATABASE *db )
datasize = msi_string_totalsize( db->strings, &count );
poolsize = count*2*sizeof(USHORT);
pool = HeapAlloc( GetProcessHeap(), 0, poolsize );
pool = msi_alloc( poolsize );
if( ! pool )
{
WARN("Failed to alloc pool %d bytes\n", poolsize );
goto err;
}
data = HeapAlloc( GetProcessHeap(), 0, datasize );
data = msi_alloc( datasize );
if( ! data )
{
WARN("Failed to alloc data %d bytes\n", poolsize );
@ -821,7 +771,7 @@ static UINT save_string_table( MSIDATABASE *db )
}
if( sz && (sz < (datasize - used ) ) )
sz--;
TRACE("adding %u bytes %s\n", sz, data+used );
TRACE("adding %u bytes %s\n", sz, debugstr_a(data+used) );
pool[ i*2 ] = sz;
pool[ i*2 + 1 ] = msi_id_refcount( db->strings, i );
used += sz;
@ -851,8 +801,8 @@ static UINT save_string_table( MSIDATABASE *db )
ret = ERROR_SUCCESS;
err:
HeapFree( GetProcessHeap(), 0, data );
HeapFree( GetProcessHeap(), 0, pool );
msi_free( data );
msi_free( pool );
return ret;
}
@ -866,53 +816,63 @@ static const WCHAR szColumn[] = { 'C','o','l','u','m','n',0 };
static const WCHAR szNumber[] = { 'N','u','m','b','e','r',0 };
static const WCHAR szType[] = { 'T','y','p','e',0 };
struct standard_table {
LPCWSTR tablename;
LPCWSTR columnname;
UINT number;
UINT type;
} MSI_standard_tables[] =
{
{ szTables, szName, 1, MSITYPE_VALID | MSITYPE_STRING | 32},
{ szColumns, szTable, 1, MSITYPE_VALID | MSITYPE_STRING | 32},
{ szColumns, szNumber, 2, MSITYPE_VALID | 2},
{ szColumns, szName, 3, MSITYPE_VALID | MSITYPE_STRING | 32},
{ szColumns, szType, 4, MSITYPE_VALID | 2},
static const MSICOLUMNINFO _Columns_cols[4] = {
{ szColumns, 1, szTable, MSITYPE_VALID | MSITYPE_STRING | 64, 0 },
{ szColumns, 2, szNumber, MSITYPE_VALID | 2, 2 },
{ szColumns, 3, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 4 },
{ szColumns, 4, szType, MSITYPE_VALID | 2, 6 },
};
static const MSICOLUMNINFO _Tables_cols[1] = {
{ szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 0 },
};
#define STANDARD_TABLE_COUNT \
(sizeof(MSI_standard_tables)/sizeof(struct standard_table))
static UINT get_defaulttablecolumns( LPCWSTR szTable, MSICOLUMNINFO *colinfo, UINT *sz)
static UINT get_defaulttablecolumns( LPCWSTR name, MSICOLUMNINFO *colinfo, UINT *sz)
{
DWORD i, n=0;
const MSICOLUMNINFO *p;
DWORD i, n;
for(i=0; i<STANDARD_TABLE_COUNT; i++)
TRACE("%s\n", debugstr_w(name));
if (!lstrcmpW( name, szTables ))
{
if( lstrcmpW( szTable, MSI_standard_tables[i].tablename ) )
continue;
if(colinfo && (n < *sz) )
p = _Tables_cols;
n = 1;
}
else if (!lstrcmpW( name, szColumns ))
{
p = _Columns_cols;
n = 4;
}
else
return ERROR_FUNCTION_FAILED;
/* duplicate the string data so we can free it in msi_free_colinfo */
for (i=0; i<n; i++)
{
if (colinfo && (i < *sz) )
{
colinfo[n].tablename = strdupW(MSI_standard_tables[i].tablename);
colinfo[n].colname = strdupW(MSI_standard_tables[i].columnname);
colinfo[n].number = MSI_standard_tables[i].number;
colinfo[n].type = MSI_standard_tables[i].type;
/* ERR("Table %s has column %s\n",debugstr_w(colinfo[n].tablename),
debugstr_w(colinfo[n].colname)); */
if( n )
colinfo[n].offset = colinfo[n-1].offset
+ bytes_per_column( &colinfo[n-1] );
else
colinfo[n].offset = 0;
memcpy( &colinfo[i], &p[i], sizeof(MSICOLUMNINFO) );
colinfo[i].tablename = strdupW( p[i].tablename );
colinfo[i].colname = strdupW( p[i].colname );
}
n++;
if( colinfo && (n >= *sz) )
if( colinfo && (i >= *sz) )
break;
}
*sz = n;
return ERROR_SUCCESS;
}
static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count )
{
UINT i;
for( i=0; i<count; i++ )
{
msi_free( (LPWSTR) colinfo[i].tablename );
msi_free( (LPWSTR) colinfo[i].colname );
}
}
LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid)
{
UINT sz=0, r;
@ -921,13 +881,13 @@ LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid)
r = msi_id2stringW( db->strings, stringid, NULL, &sz );
if( r != ERROR_SUCCESS )
return NULL;
str = HeapAlloc( GetProcessHeap(), 0, sz*sizeof (WCHAR));
str = msi_alloc( sz*sizeof (WCHAR) );
if( !str )
return str;
r = msi_id2stringW( db->strings, stringid, str, &sz );
if( r == ERROR_SUCCESS )
return str;
HeapFree( GetProcessHeap(), 0, str );
msi_free( str );
return NULL;
}
@ -936,25 +896,23 @@ static UINT get_tablecolumns( MSIDATABASE *db,
{
UINT r, i, n=0, table_id, count, maxcount = *sz;
MSITABLE *table = NULL;
static const WCHAR szColumns[] = { '_','C','o','l','u','m','n','s',0 };
/* first check if there is a default table with that name */
r = get_defaulttablecolumns( szTableName, colinfo, sz );
if( ( r == ERROR_SUCCESS ) && *sz )
return r;
r = get_table( db, szColumns, &table);
if( r != ERROR_SUCCESS )
table = get_table( db, szColumns, _Columns_cols, 4 );
if( !table )
{
WARN("table %s not available\n", debugstr_w(szColumns));
return r;
ERR("couldn't load _Columns table\n");
return ERROR_FUNCTION_FAILED;
}
/* convert table and column names to IDs from the string table */
r = msi_string2idW( db->strings, szTableName, &table_id );
if( r != ERROR_SUCCESS )
{
release_table( db, table );
WARN("Couldn't find id for %s\n", debugstr_w(szTableName));
return r;
}
@ -972,7 +930,7 @@ static UINT get_tablecolumns( MSIDATABASE *db,
colinfo[n].tablename = MSI_makestring( db, table_id );
colinfo[n].number = table->data[ i ][ 1 ] - (1<<15);
colinfo[n].colname = MSI_makestring( db, id );
colinfo[n].type = table->data[ i ] [ 3 ];
colinfo[n].type = table->data[ i ] [ 3 ] ^ 0x8000;
/* this assumes that columns are in order in the table */
if( n )
colinfo[n].offset = colinfo[n-1].offset
@ -996,16 +954,12 @@ static UINT get_tablecolumns( MSIDATABASE *db,
}
*sz = n;
release_table( db, table );
return ERROR_SUCCESS;
}
/* try to find the table name in the _Tables table */
BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name )
{
static const WCHAR szTables[] = { '_','T','a','b','l','e','s',0 };
static const WCHAR szColumns[] = { '_','C','o','l','u','m','n','s',0 };
UINT r, table_id = 0, i, count;
MSITABLE *table = NULL;
@ -1021,8 +975,8 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name )
return FALSE;
}
r = get_table( db, szTables, &table);
if( r != ERROR_SUCCESS )
table = get_table( db, szTables, _Tables_cols, 1 );
if( !table )
{
TRACE("table %s not available\n", debugstr_w(szTables));
return FALSE;
@ -1034,8 +988,6 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name )
if( table->data[ i ][ 0 ] == table_id )
break;
release_table( db, table );
if (i!=count)
return TRUE;
@ -1141,7 +1093,7 @@ static UINT TABLE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt
return ERROR_INVALID_PARAMETER;
len = lstrlenW( tv->name ) + 2 + lstrlenW( sval );
full_name = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
full_name = msi_alloc( len*sizeof(WCHAR) );
lstrcpyW( full_name, tv->name );
lstrcatW( full_name, szDot );
lstrcatW( full_name, sval );
@ -1149,8 +1101,8 @@ static UINT TABLE_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt
r = db_get_raw_stream( tv->db, full_name, stm );
if( r )
ERR("fetching stream %s, error = %d\n",debugstr_w(full_name), r);
HeapFree( GetProcessHeap(), 0, full_name );
HeapFree( GetProcessHeap(), 0, sval );
msi_free( full_name );
msi_free( sval );
return r;
}
@ -1203,18 +1155,18 @@ static UINT table_create_new_row( struct tagMSIVIEW *view, UINT *num )
if( !tv->table )
return ERROR_INVALID_PARAMETER;
row = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, tv->row_size );
row = msi_alloc_zero( tv->row_size );
if( !row )
return ERROR_NOT_ENOUGH_MEMORY;
sz = (tv->table->row_count + 1) * sizeof (UINT*);
if( tv->table->data )
p = HeapReAlloc( GetProcessHeap(), 0, tv->table->data, sz );
p = msi_realloc( tv->table->data, sz );
else
p = HeapAlloc( GetProcessHeap(), 0, sz );
p = msi_alloc( sz );
if( !p )
{
HeapFree( GetProcessHeap(), 0, row );
msi_free( row );
return ERROR_NOT_ENOUGH_MEMORY;
}
@ -1229,19 +1181,13 @@ static UINT table_create_new_row( struct tagMSIVIEW *view, UINT *num )
static UINT TABLE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
{
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
UINT r;
TRACE("%p %p\n", tv, record);
if( tv->table )
{
release_table( tv->db, tv->table );
tv->table = NULL;
}
r = get_table( tv->db, tv->name, &tv->table );
if( r != ERROR_SUCCESS )
return r;
TRACE("There are %d columns\n", tv->num_cols );
tv->table = get_table( tv->db, tv->name, tv->columns, tv->num_cols );
if( !tv->table )
return ERROR_FUNCTION_FAILED;
return ERROR_SUCCESS;
}
@ -1255,7 +1201,6 @@ static UINT TABLE_close( struct tagMSIVIEW *view )
if( !tv->table )
return ERROR_FUNCTION_FAILED;
release_table( tv->db, tv->table );
tv->table = NULL;
return ERROR_SUCCESS;
@ -1470,23 +1415,16 @@ static UINT TABLE_delete( struct tagMSIVIEW *view )
TRACE("%p\n", view );
if( tv->table )
release_table( tv->db, tv->table );
tv->table = NULL;
if( tv->columns )
{
UINT i;
for( i=0; i<tv->num_cols; i++)
{
HeapFree( GetProcessHeap(), 0, tv->columns[i].colname );
HeapFree( GetProcessHeap(), 0, tv->columns[i].tablename );
}
HeapFree( GetProcessHeap(), 0, tv->columns );
msi_free_colinfo( tv->columns, tv->num_cols );
msi_free( tv->columns );
}
tv->columns = NULL;
HeapFree( GetProcessHeap(), 0, tv );
msi_free( tv );
return ERROR_SUCCESS;
}
@ -1510,7 +1448,7 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view )
{
MSITABLEVIEW *tv ;
UINT r, sz, column_count;
MSICOLUMNINFO *columns, *last_col;
MSICOLUMNINFO *columns;
TRACE("%p %s %p\n", db, debugstr_w(name), view );
@ -1527,38 +1465,36 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view )
TRACE("Table found\n");
sz = sizeof *tv + lstrlenW(name)*sizeof name[0] ;
tv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sz );
tv = msi_alloc_zero( sz );
if( !tv )
return ERROR_FUNCTION_FAILED;
columns = HeapAlloc( GetProcessHeap(), 0, column_count*sizeof (MSICOLUMNINFO));
columns = msi_alloc( column_count*sizeof (MSICOLUMNINFO));
if( !columns )
{
HeapFree( GetProcessHeap(), 0, tv );
msi_free( tv );
return ERROR_FUNCTION_FAILED;
}
r = get_tablecolumns( db, name, columns, &column_count );
if( r != ERROR_SUCCESS )
{
HeapFree( GetProcessHeap(), 0, columns );
HeapFree( GetProcessHeap(), 0, tv );
msi_free( columns );
msi_free( tv );
return ERROR_FUNCTION_FAILED;
}
TRACE("Table has %d columns\n", column_count);
last_col = &columns[column_count-1];
/* fill the structure */
tv->view.ops = &table_ops;
tv->db = db;
tv->columns = columns;
tv->num_cols = column_count;
tv->table = NULL;
tv->row_size = last_col->offset + bytes_per_column( last_col );
tv->row_size = msi_table_get_row_size( columns, column_count );
TRACE("one row is %d bytes\n", tv->row_size );
TRACE("%s one row is %d bytes\n", debugstr_w(name), tv->row_size );
*view = (MSIVIEW*) tv;
lstrcpyW( tv->name, name );
@ -1580,7 +1516,7 @@ UINT MSI_CommitTables( MSIDATABASE *db )
return r;
}
for( table = db->first_table; table; table = table->next )
LIST_FOR_EACH_ENTRY( table, &db->tables, MSITABLE, entry )
{
r = save_table( db, table );
if( r != ERROR_SUCCESS )

View file

@ -172,7 +172,7 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view )
if( wv )
wv->ops->delete( wv );
msiobj_release( &uv->db->hdr );
HeapFree( GetProcessHeap(), 0, uv );
msi_free( uv );
return ERROR_SUCCESS;
}
@ -209,8 +209,7 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
r = WHERE_CreateView( db, &wv, tv, expr );
if( r != ERROR_SUCCESS )
{
if( sv )
sv->ops->delete( tv );
tv->ops->delete( tv );
return r;
}
@ -218,12 +217,11 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
r = SELECT_CreateView( db, &sv, wv, columns );
if( r != ERROR_SUCCESS )
{
if( tv )
tv->ops->delete( sv );
wv->ops->delete( wv );
return r;
}
uv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *uv );
uv = msi_alloc_zero( sizeof *uv );
if( !uv )
return ERROR_FUNCTION_FAILED;

View file

@ -68,7 +68,7 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
DWORD len;
static const WCHAR separator[] = {';',0};
prop = load_dynamic_property(package, action_property, NULL);
prop = msi_dup_property(package, action_property );
if (prop)
len = strlenW(prop);
else
@ -82,7 +82,7 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
/*null*/
len++;
newprop = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
newprop = msi_alloc( len*sizeof(WCHAR) );
if (prop)
{
@ -96,8 +96,8 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
MSI_SetPropertyW(package, action_property, newprop);
TRACE("Found Related Product... %s now %s\n",debugstr_w(action_property),
debugstr_w(newprop));
HeapFree(GetProcessHeap(),0,prop);
HeapFree(GetProcessHeap(),0,newprop);
msi_free( prop );
msi_free( newprop );
}
static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)

View file

@ -1,26 +1,26 @@
/*
* Copyright (c) 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine MSI dll"
#define WINE_FILENAME_STR "msi.dll"
#define WINE_FILEVERSION 3,1,4000,2435
#define WINE_FILEVERSION_STR "3.1.4000.2435"
#define WINE_PRODUCTVERSION 3,1,4000,2435
#define WINE_PRODUCTVERSION_STR "3.1.4000.2435"
#include "wine/wine_common_ver.rc"
/*
* Copyright (c) 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine MSI dll"
#define WINE_FILENAME_STR "msi.dll"
#define WINE_FILEVERSION 3,1,4000,2435
#define WINE_FILEVERSION_STR "3.1.4000.2435"
#define WINE_PRODUCTVERSION 3,1,4000,2435
#define WINE_PRODUCTVERSION_STR "3.1.4000.2435"
#include "wine/wine_common_ver.rc"

View file

@ -242,7 +242,8 @@ static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if( r != ERROR_SUCCESS )
return r;
wv->reorder = HeapAlloc( GetProcessHeap(), 0, count*sizeof(UINT) );
msi_free( wv->reorder );
wv->reorder = msi_alloc( count*sizeof(UINT) );
if( !wv->reorder )
return ERROR_FUNCTION_FAILED;
@ -269,7 +270,7 @@ static UINT WHERE_close( struct tagMSIVIEW *view )
if( !wv->table )
return ERROR_FUNCTION_FAILED;
HeapFree( GetProcessHeap(), 0, wv->reorder );
msi_free( wv->reorder );
wv->reorder = NULL;
return wv->table->ops->close( wv->table );
@ -328,13 +329,14 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
if( wv->table )
wv->table->ops->delete( wv->table );
wv->table = 0;
HeapFree( GetProcessHeap(), 0, wv->reorder );
msi_free( wv->reorder );
wv->reorder = NULL;
wv->row_count = 0;
msiobj_release( &wv->db->hdr );
HeapFree( GetProcessHeap(), 0, wv );
msi_free( wv );
return ERROR_SUCCESS;
}
@ -444,7 +446,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
MSIWHEREVIEW *wv = NULL;
UINT count = 0, r, valid = 0;
TRACE("%p\n", wv );
TRACE("%p\n", table );
r = table->ops->get_dimensions( table, NULL, &count );
if( r != ERROR_SUCCESS )
@ -462,7 +464,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
return ERROR_FUNCTION_FAILED;
}
wv = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *wv );
wv = msi_alloc_zero( sizeof *wv );
if( !wv )
return ERROR_FUNCTION_FAILED;

View file

@ -252,6 +252,10 @@ UINT WINAPI MsiDatabaseIsTablePersistentA(MSIHANDLE, LPSTR);
UINT WINAPI MsiDatabaseIsTablePersistentW(MSIHANDLE, LPWSTR);
#define MsiDatabaseIsTablePersistent WINELIB_NAME_AW(MsiDatabaseIsTablePersistent)
UINT WINAPI MsiSequenceA(MSIHANDLE, LPCSTR, INT);
UINT WINAPI MsiSequenceW(MSIHANDLE, LPCWSTR, INT);
#define MsiSequence WINELIB_NAME_AW(MsiSequence)
UINT WINAPI MsiSummaryInfoPersist(MSIHANDLE);
UINT WINAPI MsiSummaryInfoGetPropertyCount(MSIHANDLE,UINT*);