~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/msi/msipriv.h

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Implementation of the Microsoft Installer (msi.dll)
  3  *
  4  * Copyright 2002-2005 Mike McCormack for CodeWeavers
  5  * Copyright 2005 Aric Stewart for CodeWeavers
  6  *
  7  * This library is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU Lesser General Public
  9  * License as published by the Free Software Foundation; either
 10  * version 2.1 of the License, or (at your option) any later version.
 11  *
 12  * This library is distributed in the hope that it will be useful,
 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15  * Lesser General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Lesser General Public
 18  * License along with this library; if not, write to the Free Software
 19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 20  */
 21 
 22 #ifndef __WINE_MSI_PRIVATE__
 23 #define __WINE_MSI_PRIVATE__
 24 
 25 #include <stdarg.h>
 26 
 27 #include "windef.h"
 28 #include "winbase.h"
 29 #include "fdi.h"
 30 #include "msi.h"
 31 #include "msiquery.h"
 32 #include "objbase.h"
 33 #include "objidl.h"
 34 #include "winnls.h"
 35 #include "wine/list.h"
 36 
 37 #define MSI_DATASIZEMASK 0x00ff
 38 #define MSITYPE_VALID    0x0100
 39 #define MSITYPE_LOCALIZABLE 0x200
 40 #define MSITYPE_STRING   0x0800
 41 #define MSITYPE_NULLABLE 0x1000
 42 #define MSITYPE_KEY      0x2000
 43 #define MSITYPE_TEMPORARY 0x4000
 44 
 45 
 46 /* Install UI level mask for AND operation to exclude flags */
 47 #define INSTALLUILEVEL_MASK             0x0007
 48 
 49 #define MSITYPE_IS_BINARY(type) (((type) & ~MSITYPE_NULLABLE) == (MSITYPE_STRING|MSITYPE_VALID))
 50 
 51 struct tagMSITABLE;
 52 typedef struct tagMSITABLE MSITABLE;
 53 
 54 struct string_table;
 55 typedef struct string_table string_table;
 56 
 57 struct tagMSIOBJECTHDR;
 58 typedef struct tagMSIOBJECTHDR MSIOBJECTHDR;
 59 
 60 typedef VOID (*msihandledestructor)( MSIOBJECTHDR * );
 61 
 62 struct tagMSIOBJECTHDR
 63 {
 64     UINT magic;
 65     UINT type;
 66     LONG refcount;
 67     msihandledestructor destructor;
 68 };
 69 
 70 typedef struct tagMSIDATABASE
 71 {
 72     MSIOBJECTHDR hdr;
 73     IStorage *storage;
 74     string_table *strings;
 75     UINT bytes_per_strref;
 76     LPWSTR path;
 77     LPWSTR deletefile;
 78     LPCWSTR mode;
 79     struct list tables;
 80     struct list transforms;
 81 } MSIDATABASE;
 82 
 83 typedef struct tagMSIVIEW MSIVIEW;
 84 
 85 typedef struct tagMSIQUERY
 86 {
 87     MSIOBJECTHDR hdr;
 88     MSIVIEW *view;
 89     UINT row;
 90     MSIDATABASE *db;
 91     struct list mem;
 92 } MSIQUERY;
 93 
 94 /* maybe we can use a Variant instead of doing it ourselves? */
 95 typedef struct tagMSIFIELD
 96 {
 97     UINT type;
 98     union
 99     {
100         INT iVal;
101         LPWSTR szwVal;
102         IStream *stream;
103     } u;
104 } MSIFIELD;
105 
106 typedef struct tagMSIRECORD
107 {
108     MSIOBJECTHDR hdr;
109     UINT count;       /* as passed to MsiCreateRecord */
110     MSIFIELD fields[1]; /* nb. array size is count+1 */
111 } MSIRECORD;
112 
113 typedef struct tagMSISOURCELISTINFO
114 {
115     struct list entry;
116     DWORD context;
117     DWORD options;
118     LPCWSTR property;
119     LPWSTR value;
120 } MSISOURCELISTINFO;
121 
122 typedef struct tagMSIMEDIADISK
123 {
124     struct list entry;
125     DWORD context;
126     DWORD options;
127     DWORD disk_id;
128     LPWSTR volume_label;
129     LPWSTR disk_prompt;
130 } MSIMEDIADISK;
131 
132 typedef struct tagMSIMEDIAINFO
133 {
134     UINT disk_id;
135     UINT type;
136     UINT last_sequence;
137     LPWSTR disk_prompt;
138     LPWSTR cabinet;
139     LPWSTR first_volume;
140     LPWSTR volume_label;
141     BOOL is_continuous;
142     BOOL is_extracted;
143     WCHAR source[MAX_PATH];
144 } MSIMEDIAINFO;
145 
146 typedef struct _column_info
147 {
148     LPCWSTR table;
149     LPCWSTR column;
150     INT   type;
151     BOOL   temporary;
152     struct expr *val;
153     struct _column_info *next;
154 } column_info;
155 
156 typedef const struct tagMSICOLUMNHASHENTRY *MSIITERHANDLE;
157 
158 typedef struct tagMSIVIEWOPS
159 {
160     /*
161      * fetch_int - reads one integer from {row,col} in the table
162      *
163      *  This function should be called after the execute method.
164      *  Data returned by the function should not change until
165      *   close or delete is called.
166      *  To get a string value, query the database's string table with
167      *   the integer value returned from this function.
168      */
169     UINT (*fetch_int)( struct tagMSIVIEW *view, UINT row, UINT col, UINT *val );
170 
171     /*
172      * fetch_stream - gets a stream from {row,col} in the table
173      *
174      *  This function is similar to fetch_int, except fetches a
175      *    stream instead of an integer.
176      */
177     UINT (*fetch_stream)( struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm );
178 
179     /*
180      * get_row - gets values from a row
181      *
182      */
183     UINT (*get_row)( struct tagMSIVIEW *view, UINT row, MSIRECORD **rec );
184 
185     /*
186      * set_row - sets values in a row as specified by mask
187      *
188      *  Similar semantics to fetch_int
189      */
190     UINT (*set_row)( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask );
191 
192     /*
193      * Inserts a new row into the database from the records contents
194      */
195     UINT (*insert_row)( struct tagMSIVIEW *view, MSIRECORD *record, BOOL temporary );
196 
197     /*
198      * Deletes a row from the database
199      */
200     UINT (*delete_row)( struct tagMSIVIEW *view, UINT row );
201 
202     /*
203      * execute - loads the underlying data into memory so it can be read
204      */
205     UINT (*execute)( struct tagMSIVIEW *view, MSIRECORD *record );
206 
207     /*
208      * close - clears the data read by execute from memory
209      */
210     UINT (*close)( struct tagMSIVIEW *view );
211 
212     /*
213      * get_dimensions - returns the number of rows or columns in a table.
214      *
215      *  The number of rows can only be queried after the execute method
216      *   is called. The number of columns can be queried at any time.
217      */
218     UINT (*get_dimensions)( struct tagMSIVIEW *view, UINT *rows, UINT *cols );
219 
220     /*
221      * get_column_info - returns the name and type of a specific column
222      *
223      *  The name is HeapAlloc'ed by this function and should be freed by
224      *   the caller.
225      *  The column information can be queried at any time.
226      */
227     UINT (*get_column_info)( struct tagMSIVIEW *view, UINT n, LPWSTR *name, UINT *type );
228 
229     /*
230      * modify - not yet implemented properly
231      */
232     UINT (*modify)( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *record, UINT row );
233 
234     /*
235      * delete - destroys the structure completely
236      */
237     UINT (*delete)( struct tagMSIVIEW * );
238 
239     /*
240      * find_matching_rows - iterates through rows that match a value
241      *
242      * If the column type is a string then a string ID should be passed in.
243      *  If the value to be looked up is an integer then no transformation of
244      *  the input value is required, except if the column is a string, in which
245      *  case a string ID should be passed in.
246      * The handle is an input/output parameter that keeps track of the current
247      *  position in the iteration. It must be initialised to zero before the
248      *  first call and continued to be passed in to subsequent calls.
249      */
250     UINT (*find_matching_rows)( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle );
251 
252     /*
253      * add_ref - increases the reference count of the table
254      */
255     UINT (*add_ref)( struct tagMSIVIEW *view );
256 
257     /*
258      * release - decreases the reference count of the table
259      */
260     UINT (*release)( struct tagMSIVIEW *view );
261 
262     /*
263      * add_column - adds a column to the table
264      */
265     UINT (*add_column)( struct tagMSIVIEW *view, LPCWSTR table, UINT number, LPCWSTR column, UINT type, BOOL hold );
266 
267     /*
268      * remove_column - removes the column represented by table name and column number from the table
269      */
270     UINT (*remove_column)( struct tagMSIVIEW *view, LPCWSTR table, UINT number );
271 
272     /*
273      * sort - orders the table by columns
274      */
275     UINT (*sort)( struct tagMSIVIEW *view, column_info *columns );
276 } MSIVIEWOPS;
277 
278 struct tagMSIVIEW
279 {
280     MSIOBJECTHDR hdr;
281     const MSIVIEWOPS *ops;
282 };
283 
284 struct msi_dialog_tag;
285 typedef struct msi_dialog_tag msi_dialog;
286 
287 typedef struct tagMSIPACKAGE
288 {
289     MSIOBJECTHDR hdr;
290     MSIDATABASE *db;
291     struct list components;
292     struct list features;
293     struct list files;
294     struct list tempfiles;
295     struct list folders;
296     LPWSTR ActionFormat;
297     LPWSTR LastAction;
298 
299     struct list classes;
300     struct list extensions;
301     struct list progids;
302     struct list mimes;
303     struct list appids;
304 
305     struct tagMSISCRIPT *script;
306 
307     struct list RunningActions;
308 
309     LPWSTR BaseURL;
310     LPWSTR PackagePath;
311     LPWSTR ProductCode;
312 
313     UINT CurrentInstallState;
314     msi_dialog *dialog;
315     LPWSTR next_dialog;
316     float center_x;
317     float center_y;
318 
319     UINT WordCount;
320     UINT Context;
321 
322     struct list subscriptions;
323 
324     struct list sourcelist_info;
325     struct list sourcelist_media;
326 
327     unsigned char scheduled_action_running : 1;
328     unsigned char commit_action_running : 1;
329     unsigned char rollback_action_running : 1;
330 } MSIPACKAGE;
331 
332 typedef struct tagMSIPREVIEW
333 {
334     MSIOBJECTHDR hdr;
335     MSIPACKAGE *package;
336     msi_dialog *dialog;
337 } MSIPREVIEW;
338 
339 #define MSI_MAX_PROPS 20
340 
341 typedef struct tagMSISUMMARYINFO
342 {
343     MSIOBJECTHDR hdr;
344     IStorage *storage;
345     DWORD update_count;
346     PROPVARIANT property[MSI_MAX_PROPS];
347 } MSISUMMARYINFO;
348 
349 typedef struct tagMSIFEATURE
350 {
351     struct list entry;
352     LPWSTR Feature;
353     LPWSTR Feature_Parent;
354     LPWSTR Title;
355     LPWSTR Description;
356     INT Display;
357     INT Level;
358     LPWSTR Directory;
359     INT Attributes;
360     INSTALLSTATE Installed;
361     INSTALLSTATE ActionRequest;
362     INSTALLSTATE Action;
363     struct list Children;
364     struct list Components;
365     INT Cost;
366 } MSIFEATURE;
367 
368 typedef struct tagMSICOMPONENT
369 {
370     struct list entry;
371     DWORD magic;
372     LPWSTR Component;
373     LPWSTR ComponentId;
374     LPWSTR Directory;
375     INT Attributes;
376     LPWSTR Condition;
377     LPWSTR KeyPath;
378     INSTALLSTATE Installed;
379     INSTALLSTATE ActionRequest;
380     INSTALLSTATE Action;
381     BOOL ForceLocalState;
382     BOOL Enabled;
383     INT  Cost;
384     INT  RefCount;
385     LPWSTR FullKeypath;
386     LPWSTR AdvertiseString;
387 
388     unsigned int anyAbsent:1;
389     unsigned int hasAdvertiseFeature:1;
390     unsigned int hasLocalFeature:1;
391     unsigned int hasSourceFeature:1;
392 } MSICOMPONENT;
393 
394 typedef struct tagComponentList
395 {
396     struct list entry;
397     MSICOMPONENT *component;
398 } ComponentList;
399 
400 typedef struct tagFeatureList
401 {
402     struct list entry;
403     MSIFEATURE *feature;
404 } FeatureList;
405 
406 typedef struct tagMSIFOLDER
407 {
408     struct list entry;
409     LPWSTR Directory;
410     LPWSTR Parent;
411     LPWSTR TargetDefault;
412     LPWSTR SourceLongPath;
413     LPWSTR SourceShortPath;
414 
415     LPWSTR ResolvedTarget;
416     LPWSTR ResolvedSource;
417     LPWSTR Property;   /* initially set property */
418     INT   State;
419         /* 0 = uninitialized */
420         /* 1 = existing */
421         /* 2 = created remove if empty */
422         /* 3 = created persist if empty */
423     INT   Cost;
424     INT   Space;
425 } MSIFOLDER;
426 
427 typedef enum _msi_file_state {
428     msifs_invalid,
429     msifs_missing,
430     msifs_overwrite,
431     msifs_present,
432     msifs_installed,
433     msifs_skipped,
434 } msi_file_state;
435 
436 typedef struct tagMSIFILE
437 {
438     struct list entry;
439     LPWSTR File;
440     MSICOMPONENT *Component;
441     LPWSTR FileName;
442     LPWSTR ShortName;
443     LPWSTR LongName;
444     INT FileSize;
445     LPWSTR Version;
446     LPWSTR Language;
447     INT Attributes;
448     INT Sequence;
449     msi_file_state state;
450     LPWSTR  SourcePath;
451     LPWSTR  TargetPath;
452     BOOL IsCompressed;
453     MSIFILEHASHINFO hash;
454 } MSIFILE;
455 
456 typedef struct tagMSITEMPFILE
457 {
458     struct list entry;
459     LPWSTR Path;
460 } MSITEMPFILE;
461 
462 typedef struct tagMSIAPPID
463 {
464     struct list entry;
465     LPWSTR AppID; /* Primary key */
466     LPWSTR RemoteServerName;
467     LPWSTR LocalServer;
468     LPWSTR ServiceParameters;
469     LPWSTR DllSurrogate;
470     BOOL ActivateAtStorage;
471     BOOL RunAsInteractiveUser;
472 } MSIAPPID;
473 
474 typedef struct tagMSIPROGID MSIPROGID;
475 
476 typedef struct tagMSICLASS
477 {
478     struct list entry;
479     LPWSTR clsid;     /* Primary Key */
480     LPWSTR Context;   /* Primary Key */
481     MSICOMPONENT *Component;
482     MSIPROGID *ProgID;
483     LPWSTR ProgIDText;
484     LPWSTR Description;
485     MSIAPPID *AppID;
486     LPWSTR FileTypeMask;
487     LPWSTR IconPath;
488     LPWSTR DefInprocHandler;
489     LPWSTR DefInprocHandler32;
490     LPWSTR Argument;
491     MSIFEATURE *Feature;
492     INT Attributes;
493     /* not in the table, set during installation */
494     BOOL Installed;
495 } MSICLASS;
496 
497 typedef struct tagMSIMIME MSIMIME;
498 
499 typedef struct tagMSIEXTENSION
500 {
501     struct list entry;
502     LPWSTR Extension;  /* Primary Key */
503     MSICOMPONENT *Component;
504     MSIPROGID *ProgID;
505     LPWSTR ProgIDText;
506     MSIMIME *Mime;
507     MSIFEATURE *Feature;
508     /* not in the table, set during installation */
509     BOOL Installed;
510     struct list verbs;
511 } MSIEXTENSION;
512 
513 struct tagMSIPROGID
514 {
515     struct list entry;
516     LPWSTR ProgID;  /* Primary Key */
517     MSIPROGID *Parent;
518     MSICLASS *Class;
519     LPWSTR Description;
520     LPWSTR IconPath;
521     /* not in the table, set during installation */
522     BOOL InstallMe;
523     MSIPROGID *CurVer;
524     MSIPROGID *VersionInd;
525 };
526 
527 typedef struct tagMSIVERB
528 {
529     struct list entry;
530     LPWSTR Verb;
531     INT Sequence;
532     LPWSTR Command;
533     LPWSTR Argument;
534 } MSIVERB;
535 
536 struct tagMSIMIME
537 {
538     struct list entry;
539     LPWSTR ContentType;  /* Primary Key */
540     MSIEXTENSION *Extension;
541     LPWSTR clsid;
542     MSICLASS *Class;
543     /* not in the table, set during installation */
544     BOOL InstallMe;
545 };
546 
547 enum SCRIPTS {
548     INSTALL_SCRIPT = 0,
549     COMMIT_SCRIPT = 1,
550     ROLLBACK_SCRIPT = 2,
551     TOTAL_SCRIPTS = 3
552 };
553 
554 #define SEQUENCE_UI       0x1
555 #define SEQUENCE_EXEC     0x2
556 #define SEQUENCE_INSTALL  0x10
557 
558 typedef struct tagMSISCRIPT
559 {
560     LPWSTR  *Actions[TOTAL_SCRIPTS];
561     UINT    ActionCount[TOTAL_SCRIPTS];
562     BOOL    ExecuteSequenceRun;
563     BOOL    CurrentlyScripting;
564     UINT    InWhatSequence;
565     LPWSTR  *UniqueActions;
566     UINT    UniqueActionsCount;
567 } MSISCRIPT;
568 
569 #define MSIHANDLETYPE_ANY 0
570 #define MSIHANDLETYPE_DATABASE 1
571 #define MSIHANDLETYPE_SUMMARYINFO 2
572 #define MSIHANDLETYPE_VIEW 3
573 #define MSIHANDLETYPE_RECORD 4
574 #define MSIHANDLETYPE_PACKAGE 5
575 #define MSIHANDLETYPE_PREVIEW 6
576 
577 #define MSI_MAJORVERSION 3
578 #define MSI_MINORVERSION 1
579 #define MSI_BUILDNUMBER 4000
580 
581 #define GUID_SIZE 39
582 #define SQUISH_GUID_SIZE 33
583 
584 #define MSIHANDLE_MAGIC 0x4d434923
585 
586 DEFINE_GUID(CLSID_IMsiServer,   0x000C101C,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
587 DEFINE_GUID(CLSID_IMsiServerX1, 0x000C103E,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
588 DEFINE_GUID(CLSID_IMsiServerX2, 0x000C1090,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
589 DEFINE_GUID(CLSID_IMsiServerX3, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
590 
591 DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
592 
593 DEFINE_GUID(CLSID_IWineMsiRemoteCustomAction,0xBA26E6FA,0x4F27,0x4f56,0x95,0x3A,0x3F,0x90,0x27,0x20,0x18,0xAA);
594 DEFINE_GUID(CLSID_IWineMsiRemotePackage,0x902b3592,0x9d08,0x4dfd,0xa5,0x93,0xd0,0x7c,0x52,0x54,0x64,0x21);
595 
596 /* handle unicode/ascii output in the Msi* API functions */
597 typedef struct {
598     BOOL unicode;
599     union {
600        LPSTR a;
601        LPWSTR w;
602     } str;
603 } awstring;
604 
605 typedef struct {
606     BOOL unicode;
607     union {
608        LPCSTR a;
609        LPCWSTR w;
610     } str;
611 } awcstring;
612 
613 UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz );
614 
615 /* msi server interface */
616 extern ITypeLib *get_msi_typelib( LPWSTR *path );
617 extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj );
618 extern HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj );
619 extern HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj );
620 extern IUnknown *msi_get_remote(MSIHANDLE handle);
621 
622 /* handle functions */
623 extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
624 extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * );
625 extern MSIHANDLE alloc_msi_remote_handle( IUnknown *unk );
626 extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy );
627 extern void msiobj_addref(MSIOBJECTHDR *);
628 extern int msiobj_release(MSIOBJECTHDR *);
629 extern void msiobj_lock(MSIOBJECTHDR *);
630 extern void msiobj_unlock(MSIOBJECTHDR *);
631 extern void msi_free_handle_table(void);
632 
633 extern void free_cached_tables( MSIDATABASE *db );
634 extern void msi_free_transforms( MSIDATABASE *db );
635 extern UINT MSI_CommitTables( MSIDATABASE *db );
636 
637 
638 /* string table functions */
639 enum StringPersistence
640 {
641     StringPersistent = 0,
642     StringNonPersistent = 1
643 };
644 
645 extern BOOL msi_addstringW( string_table *st, UINT string_no, const WCHAR *data, int len, UINT refcount, enum StringPersistence persistence );
646 extern UINT msi_id2stringW( const string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
647 extern UINT msi_id2stringA( const string_table *st, UINT string_no, LPSTR buffer, UINT *sz );
648 
649 extern UINT msi_string2idW( const string_table *st, LPCWSTR buffer, UINT *id );
650 extern UINT msi_string2idA( const string_table *st, LPCSTR str, UINT *id );
651 extern VOID msi_destroy_stringtable( string_table *st );
652 extern UINT msi_strcmp( const string_table *st, UINT lval, UINT rval, UINT *res );
653 extern const WCHAR *msi_string_lookup_id( const string_table *st, UINT id );
654 extern HRESULT msi_init_string_table( IStorage *stg );
655 extern string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref );
656 extern UINT msi_save_string_table( const string_table *st, IStorage *storage );
657 
658 
659 extern void msi_table_set_strref(UINT bytes_per_strref);
660 extern BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name );
661 extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table );
662 
663 extern UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname,
664                                   USHORT **pdata, UINT *psz );
665 extern UINT read_stream_data( IStorage *stg, LPCWSTR stname, BOOL table,
666                               BYTE **pdata, UINT *psz );
667 extern UINT write_stream_data( IStorage *stg, LPCWSTR stname,
668                                LPCVOID data, UINT sz, BOOL bTable );
669 
670 /* transform functions */
671 extern UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg );
672 extern UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db,
673                  LPCWSTR szTransformFile, int iErrorCond );
674 extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg );
675 
676 /* action internals */
677 extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR );
678 extern void ACTION_free_package_structures( MSIPACKAGE* );
679 extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR);
680 extern UINT ACTION_ForceReboot(MSIPACKAGE *package);
681 extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode );
682 extern UINT MSI_SetFeatureStates( MSIPACKAGE *package );
683 extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine );
684 
685 /* record internals */
686 extern UINT MSI_RecordSetIStream( MSIRECORD *, UINT, IStream *);
687 extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **);
688 extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT );
689 extern MSIRECORD *MSI_CreateRecord( UINT );
690 extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int );
691 extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR );
692 extern UINT MSI_RecordSetStringA( MSIRECORD *, UINT, LPCSTR );
693 extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT );
694 extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD);
695 extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD);
696 extern int MSI_RecordGetInteger( MSIRECORD *, UINT );
697 extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD);
698 extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec );
699 extern UINT MSI_RecordSetStream( MSIRECORD *, UINT, IStream * );
700 extern UINT MSI_RecordDataSize( MSIRECORD *, UINT );
701 extern UINT MSI_RecordStreamToFile( MSIRECORD *, UINT, LPCWSTR );
702 extern UINT MSI_RecordCopyField( MSIRECORD *, UINT, MSIRECORD *, UINT );
703 
704 /* stream internals */
705 extern UINT get_raw_stream( MSIHANDLE hdb, LPCWSTR stname, IStream **stm );
706 extern UINT db_get_raw_stream( MSIDATABASE *db, LPCWSTR stname, IStream **stm );
707 extern void enum_stream_names( IStorage *stg );
708 extern BOOL decode_streamname(LPCWSTR in, LPWSTR out);
709 extern LPWSTR encode_streamname(BOOL bTable, LPCWSTR in);
710 
711 /* database internals */
712 extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** );
713 extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** );
714 extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... );
715 typedef UINT (*record_func)( MSIRECORD *, LPVOID );
716 extern UINT MSI_IterateRecords( MSIQUERY *, LPDWORD, record_func, LPVOID );
717 extern MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... );
718 extern UINT MSI_DatabaseImport( MSIDATABASE *, LPCWSTR, LPCWSTR );
719 extern UINT MSI_DatabaseExport( MSIDATABASE *, LPCWSTR, LPCWSTR, LPCWSTR );
720 extern UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *, LPCWSTR, MSIRECORD ** );
721 
722 /* view internals */
723 extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * );
724 extern UINT MSI_ViewFetch( MSIQUERY*, MSIRECORD ** );
725 extern UINT MSI_ViewClose( MSIQUERY* );
726 extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **);
727 extern UINT MSI_ViewModify( MSIQUERY *, MSIMODIFY, MSIRECORD * );
728 extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, UINT * );
729 extern UINT msi_view_get_row(MSIDATABASE *, MSIVIEW *, UINT, MSIRECORD **);
730 
731 /* install internals */
732 extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel );
733 
734 /* package internals */
735 extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *, LPCWSTR );
736 extern UINT MSI_OpenPackageW( LPCWSTR szPackage, MSIPACKAGE **pPackage );
737 extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
738 extern UINT MSI_SetPropertyW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
739 extern INT MSI_ProcessMessage( MSIPACKAGE *, INSTALLMESSAGE, MSIRECORD * );
740 extern UINT MSI_GetPropertyW( MSIPACKAGE *, LPCWSTR, LPWSTR, LPDWORD );
741 extern UINT MSI_GetPropertyA(MSIPACKAGE *, LPCSTR, LPSTR, LPDWORD );
742 extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR );
743 extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * );
744 extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * );
745 extern UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE );
746 extern LPCWSTR msi_download_file( LPCWSTR szUrl, LPWSTR filename );
747 extern UINT msi_package_add_info(MSIPACKAGE *, DWORD, DWORD, LPCWSTR, LPWSTR);
748 extern UINT msi_package_add_media_disk(MSIPACKAGE *, DWORD, DWORD, DWORD, LPWSTR, LPWSTR);
749 extern UINT msi_clone_properties(MSIPACKAGE *);
750 
751 /* for deformating */
752 extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, LPDWORD );
753 
754 /* registry data encoding/decoding functions */
755 extern BOOL unsquash_guid(LPCWSTR in, LPWSTR out);
756 extern BOOL squash_guid(LPCWSTR in, LPWSTR out);
757 extern BOOL encode_base85_guid(GUID *,LPWSTR);
758 extern BOOL decode_base85_guid(LPCWSTR,GUID*);
759 extern UINT MSIREG_OpenUninstallKey(LPCWSTR szProduct, HKEY* key, BOOL create);
760 extern UINT MSIREG_DeleteUninstallKey(LPCWSTR szProduct);
761 extern UINT MSIREG_OpenUserProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
762 extern UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
763 extern UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
764 extern UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL create);
765 extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
766 extern UINT MSIREG_OpenLocalUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create);
767 extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create);
768 extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
769 extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
770 extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create);
771 extern UINT MSIREG_OpenLocalUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create);
772 extern UINT MSIREG_OpenCurrentUserInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create);
773 extern UINT MSIREG_OpenLocalSystemInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create);
774 extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
775 extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
776 extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
777 extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
778 extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct);
779 extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct);
780 extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct);
781 extern UINT MSIREG_OpenLocalSystemProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create);
782 extern UINT MSIREG_OpenLocalSystemComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create);
783 extern UINT MSIREG_OpenLocalClassesProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create);
784 extern UINT MSIREG_OpenLocalClassesFeaturesKey(LPCWSTR szProductCode, HKEY *key, BOOL create);
785 extern UINT MSIREG_OpenLocalManagedProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create);
786 extern UINT MSIREG_OpenManagedFeaturesKey(LPCWSTR szProductCode, HKEY *key, BOOL create);
787 extern UINT MSIREG_OpenLocalUserDataFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL create);
788 extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct);
789 extern UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent);
790 extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent);
791 extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode);
792 extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create);
793 extern UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode);
794 extern UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode);
795 
796 extern LPWSTR msi_reg_get_val_str( HKEY hkey, LPCWSTR name );
797 extern BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val);
798 
799 extern DWORD msi_version_str_to_dword(LPCWSTR p);
800 extern LPWSTR msi_version_dword_to_str(DWORD version);
801 
802 extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
803 extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
804 extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val );
805 extern LONG msi_reg_set_subkey_val( HKEY hkey, LPCWSTR path, LPCWSTR name, LPCWSTR val );
806 
807 /* msi dialog interface */
808 typedef UINT (*msi_dialog_event_handler)( MSIPACKAGE*, LPCWSTR, LPCWSTR, msi_dialog* );
809 extern msi_dialog *msi_dialog_create( MSIPACKAGE*, LPCWSTR, msi_dialog*, msi_dialog_event_handler );
810 extern UINT msi_dialog_run_message_loop( msi_dialog* );
811 extern void msi_dialog_end_dialog( msi_dialog* );
812 extern void msi_dialog_check_messages( HANDLE );
813 extern void msi_dialog_do_preview( msi_dialog* );
814 extern void msi_dialog_destroy( msi_dialog* );
815 extern BOOL msi_dialog_register_class( void );
816 extern void msi_dialog_unregister_class( void );
817 extern void msi_dialog_handle_event( msi_dialog*, LPCWSTR, LPCWSTR, MSIRECORD * );
818 extern UINT msi_dialog_reset( msi_dialog *dialog );
819 extern UINT msi_dialog_directorylist_up( msi_dialog *dialog );
820 extern msi_dialog *msi_dialog_get_parent( msi_dialog *dialog );
821 extern LPWSTR msi_dialog_get_name( msi_dialog *dialog );
822 extern UINT msi_spawn_error_dialog( MSIPACKAGE*, LPWSTR, LPWSTR );
823 
824 /* preview */
825 extern MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE * );
826 extern UINT MSI_PreviewDialogW( MSIPREVIEW *, LPCWSTR );
827 
828 /* summary information */
829 extern MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, UINT uiUpdateCount );
830 extern LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty );
831 extern LPWSTR msi_get_suminfo_product( IStorage *stg );
832 
833 /* undocumented functions */
834 UINT WINAPI MsiCreateAndVerifyInstallerDirectory( DWORD );
835 UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR, LPWSTR, LPWSTR, LPWSTR, LPDWORD );
836 UINT WINAPI MsiDecomposeDescriptorA( LPCSTR, LPSTR, LPSTR, LPSTR, LPDWORD );
837 LANGID WINAPI MsiLoadStringW( MSIHANDLE, UINT, LPWSTR, int, LANGID );
838 LANGID WINAPI MsiLoadStringA( MSIHANDLE, UINT, LPSTR, int, LANGID );
839 
840 /* UI globals */
841 extern INSTALLUILEVEL gUILevel;
842 extern HWND gUIhwnd;
843 extern INSTALLUI_HANDLERA gUIHandlerA;
844 extern INSTALLUI_HANDLERW gUIHandlerW;
845 extern DWORD gUIFilter;
846 extern LPVOID gUIContext;
847 extern WCHAR gszLogFile[MAX_PATH];
848 extern HINSTANCE msi_hInstance;
849 
850 /* action related functions */
851 extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script, BOOL force);
852 extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UINT script);
853 extern void ACTION_FinishCustomActions( const MSIPACKAGE* package);
854 extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, UINT script, BOOL execute);
855 
856 static inline void msi_feature_set_state( MSIFEATURE *feature, INSTALLSTATE state )
857 {
858     feature->ActionRequest = state;
859     feature->Action = state;
860 }
861 
862 static inline void msi_component_set_state( MSICOMPONENT *comp, INSTALLSTATE state )
863 {
864     if (state == INSTALLSTATE_ABSENT)
865     {
866         switch (comp->Installed)
867         {
868             case INSTALLSTATE_LOCAL:
869             case INSTALLSTATE_SOURCE:
870             case INSTALLSTATE_DEFAULT:
871                 comp->ActionRequest = state;
872                 comp->Action = state;
873                 break;
874             default:
875                 comp->ActionRequest = INSTALLSTATE_UNKNOWN;
876                 comp->Action = INSTALLSTATE_UNKNOWN;
877         }
878     }
879     else if (state == INSTALLSTATE_SOURCE)
880     {
881         switch (comp->Installed)
882         {
883             case INSTALLSTATE_ABSENT:
884             case INSTALLSTATE_SOURCE:
885                 comp->ActionRequest = state;
886                 comp->Action = state;
887                 break;
888             default:
889                 comp->ActionRequest = INSTALLSTATE_UNKNOWN;
890                 comp->Action = INSTALLSTATE_UNKNOWN;
891         }
892     }
893     else
894     {
895         comp->ActionRequest = state;
896         comp->Action = state;
897     }
898 }
899 
900 /* actions in other modules */
901 extern UINT ACTION_AppSearch(MSIPACKAGE *package);
902 extern UINT ACTION_CCPSearch(MSIPACKAGE *package);
903 extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
904 extern UINT ACTION_InstallFiles(MSIPACKAGE *package);
905 extern UINT ACTION_RemoveFiles(MSIPACKAGE *package);
906 extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
907 extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
908 extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
909 extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
910 extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
911 extern UINT ACTION_RegisterFonts(MSIPACKAGE *package);
912 
913 /* Helpers */
914 extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
915 extern LPWSTR msi_dup_record_field(MSIRECORD *row, INT index);
916 extern LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop);
917 extern int msi_get_property_int( MSIPACKAGE *package, LPCWSTR prop, int def );
918 extern LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
919                       BOOL set_prop, BOOL load_prop, MSIFOLDER **folder);
920 extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
921 extern MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
922 extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
923 extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
924 extern int track_tempfile(MSIPACKAGE *package, LPCWSTR path);
925 extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
926 extern void msi_free_action_script(MSIPACKAGE *package, UINT script);
927 extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
928 extern LPWSTR build_directory_name(DWORD , ...);
929 extern BOOL create_full_pathW(const WCHAR *path);
930 extern BOOL ACTION_VerifyComponentForAction(const MSICOMPONENT*, INSTALLSTATE);
931 extern BOOL ACTION_VerifyFeatureForAction(const MSIFEATURE*, INSTALLSTATE);
932 extern void reduce_to_longfilename(WCHAR*);
933 extern void reduce_to_shortfilename(WCHAR*);
934 extern LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
935 extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
936 extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR);
937 extern BOOL check_unique_action(const MSIPACKAGE *, LPCWSTR);
938 extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
939 extern UINT msi_create_component_directories( MSIPACKAGE *package );
940 extern void msi_ui_error( DWORD msg_id, DWORD type );
941 extern UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
942                         MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value);
943 
944 /* media */
945 
946 typedef BOOL (*PMSICABEXTRACTCB)(MSIPACKAGE *, LPCWSTR, DWORD, LPWSTR *, DWORD *, PVOID);
947 
948 #define MSICABEXTRACT_BEGINEXTRACT  0x01
949 #define MSICABEXTRACT_FILEEXTRACTED 0x02
950 
951 typedef struct
952 {
953     MSIPACKAGE* package;
954     MSIMEDIAINFO *mi;
955     PMSICABEXTRACTCB cb;
956     LPWSTR curfile;
957     PVOID user;
958 } MSICABDATA;
959 
960 extern UINT ready_media(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO *mi);
961 extern UINT msi_load_media_info(MSIPACKAGE *package, MSIFILE *file, MSIMEDIAINFO *mi);
962 extern void msi_free_media_info(MSIMEDIAINFO *mi);
963 extern BOOL msi_cabextract(MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data);
964 extern UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi);
965 
966 /* control event stuff */
967 extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
968                                       MSIRECORD *data);
969 extern VOID ControlEvent_CleanupDialogSubscriptions(MSIPACKAGE *package, LPWSTR dialog);
970 extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
971 extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, msi_dialog *dialog,
972                                       LPCWSTR event, LPCWSTR control, LPCWSTR attribute);
973 extern VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
974                                       LPCWSTR control, LPCWSTR attribute );
975 
976 /* OLE automation */
977 extern HRESULT create_msiserver(IUnknown *pOuter, LPVOID *ppObj);
978 extern HRESULT create_session(MSIHANDLE msiHandle, IDispatch *pInstaller, IDispatch **pDispatch);
979 extern HRESULT load_type_info(IDispatch *iface, ITypeInfo **pptinfo, REFIID clsid, LCID lcid);
980 
981 /* Scripting */
982 extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action);
983 
984 /* User Interface messages from the actions */
985 extern void ui_progress(MSIPACKAGE *, int, int, int, int);
986 extern void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
987 
988 /* string consts use a number of places  and defined in helpers.c*/
989 extern const WCHAR cszSourceDir[];
990 extern const WCHAR cszSOURCEDIR[];
991 extern const WCHAR szProductCode[];
992 extern const WCHAR cszRootDrive[];
993 extern const WCHAR cszbs[];
994 
995 /* memory allocation macro functions */
996 static inline void *msi_alloc( size_t len )
997 {
998     return HeapAlloc( GetProcessHeap(), 0, len );
999 }
1000 
1001 static inline void *msi_alloc_zero( size_t len )
1002 {
1003     return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len );
1004 }
1005 
1006 static inline void *msi_realloc( void *mem, size_t len )
1007 {
1008     return HeapReAlloc( GetProcessHeap(), 0, mem, len );
1009 }
1010 
1011 static inline void *msi_realloc_zero( void *mem, size_t len )
1012 {
1013     return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len );
1014 }
1015 
1016 static inline BOOL msi_free( void *mem )
1017 {
1018     return HeapFree( GetProcessHeap(), 0, mem );
1019 }
1020 
1021 static inline char *strdupWtoA( LPCWSTR str )
1022 {
1023     LPSTR ret = NULL;
1024     DWORD len;
1025 
1026     if (!str) return ret;
1027     len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1028     ret = msi_alloc( len );
1029     if (ret)
1030         WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
1031     return ret;
1032 }
1033 
1034 static inline LPWSTR strdupAtoW( LPCSTR str )
1035 {
1036     LPWSTR ret = NULL;
1037     DWORD len;
1038 
1039     if (!str) return ret;
1040     len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
1041     ret = msi_alloc( len * sizeof(WCHAR) );
1042     if (ret)
1043         MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
1044     return ret;
1045 }
1046 
1047 static inline LPWSTR strdupW( LPCWSTR src )
1048 {
1049     LPWSTR dest;
1050     if (!src) return NULL;
1051     dest = msi_alloc( (lstrlenW(src)+1)*sizeof(WCHAR) );
1052     if (dest)
1053         lstrcpyW(dest, src);
1054     return dest;
1055 }
1056 
1057 #endif /* __WINE_MSI_PRIVATE__ */
1058 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.