Commit ca2c8c86 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Eliminate yet more fixed length buffers.

parent 261e3764
...@@ -129,7 +129,7 @@ typedef struct tagMSITEMPFILE ...@@ -129,7 +129,7 @@ typedef struct tagMSITEMPFILE
typedef struct tagMSIAPPID typedef struct tagMSIAPPID
{ {
struct list entry; struct list entry;
WCHAR AppID[IDENTIFIER_SIZE]; /* Primary key */ LPWSTR AppID; /* Primary key */
LPWSTR RemoteServerName; LPWSTR RemoteServerName;
LPWSTR LocalServer; LPWSTR LocalServer;
LPWSTR ServiceParameters; LPWSTR ServiceParameters;
...@@ -143,8 +143,8 @@ typedef struct tagMSIPROGID MSIPROGID; ...@@ -143,8 +143,8 @@ typedef struct tagMSIPROGID MSIPROGID;
typedef struct tagMSICLASS typedef struct tagMSICLASS
{ {
struct list entry; struct list entry;
WCHAR CLSID[IDENTIFIER_SIZE]; /* Primary Key */ LPWSTR clsid; /* Primary Key */
WCHAR Context[IDENTIFIER_SIZE]; /* Primary Key */ LPWSTR Context; /* Primary Key */
MSICOMPONENT *Component; MSICOMPONENT *Component;
MSIPROGID *ProgID; MSIPROGID *ProgID;
LPWSTR ProgIDText; LPWSTR ProgIDText;
...@@ -205,7 +205,7 @@ struct tagMSIMIME ...@@ -205,7 +205,7 @@ struct tagMSIMIME
struct list entry; struct list entry;
LPWSTR ContentType; /* Primary Key */ LPWSTR ContentType; /* Primary Key */
MSIEXTENSION *Extension; MSIEXTENSION *Extension;
WCHAR CLSID[IDENTIFIER_SIZE]; LPWSTR clsid;
MSICLASS *Class; MSICLASS *Class;
/* not in the table, set during installation */ /* not in the table, set during installation */
BOOL InstallMe; BOOL InstallMe;
......
...@@ -56,7 +56,6 @@ extern const WCHAR szUnregisterProgIdInfo[]; ...@@ -56,7 +56,6 @@ extern const WCHAR szUnregisterProgIdInfo[];
static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
{ {
DWORD sz;
LPCWSTR buffer; LPCWSTR buffer;
MSIAPPID *appid; MSIAPPID *appid;
...@@ -66,8 +65,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -66,8 +65,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
if (!appid) if (!appid)
return NULL; return NULL;
sz = IDENTIFIER_SIZE; appid->AppID = load_dynamic_stringW( row, 1 );
MSI_RecordGetStringW(row, 1, appid->AppID, &sz);
TRACE("loading appid %s\n", debugstr_w( appid->AppID )); TRACE("loading appid %s\n", debugstr_w( appid->AppID ));
buffer = MSI_RecordGetString(row,2); buffer = MSI_RecordGetString(row,2);
...@@ -228,7 +226,7 @@ static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name) ...@@ -228,7 +226,7 @@ static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name)
static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
{ {
MSICLASS *cls; MSICLASS *cls;
DWORD sz,i; DWORD i;
LPCWSTR buffer; LPCWSTR buffer;
/* fill in the data */ /* fill in the data */
...@@ -239,11 +237,9 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -239,11 +237,9 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
list_add_tail( &package->classes, &cls->entry ); list_add_tail( &package->classes, &cls->entry );
sz = IDENTIFIER_SIZE; cls->clsid = load_dynamic_stringW( row, 1 );
MSI_RecordGetStringW(row, 1, cls->CLSID, &sz); TRACE("loading class %s\n",debugstr_w(cls->clsid));
TRACE("loading class %s\n",debugstr_w(cls->CLSID)); cls->Context = load_dynamic_stringW( row, 2 );
sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row, 2, cls->Context, &sz);
buffer = MSI_RecordGetString(row,3); buffer = MSI_RecordGetString(row,3);
cls->Component = get_loaded_component(package, buffer); cls->Component = get_loaded_component(package, buffer);
...@@ -345,7 +341,7 @@ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid) ...@@ -345,7 +341,7 @@ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid)
/* check for classes already loaded */ /* check for classes already loaded */
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
{ {
if (lstrcmpiW( cls->CLSID, classid )==0) if (lstrcmpiW( cls->clsid, classid )==0)
{ {
TRACE("found class %s (%p)\n",debugstr_w(classid), cls); TRACE("found class %s (%p)\n",debugstr_w(classid), cls);
return cls; return cls;
...@@ -366,7 +362,6 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR extensio ...@@ -366,7 +362,6 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR extensio
static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
{ {
DWORD sz;
LPCWSTR buffer; LPCWSTR buffer;
MSIMIME *mt; MSIMIME *mt;
...@@ -382,9 +377,8 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -382,9 +377,8 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
buffer = MSI_RecordGetString( row, 2 ); buffer = MSI_RecordGetString( row, 2 );
mt->Extension = load_given_extension( package, buffer ); mt->Extension = load_given_extension( package, buffer );
sz = IDENTIFIER_SIZE; mt->clsid = load_dynamic_stringW( row, 3 );
MSI_RecordGetStringW( row, 3, mt->CLSID, &sz ); mt->Class = load_given_class( package, mt->clsid );
mt->Class = load_given_class( package, mt->CLSID );
list_add_tail( &package->mimes, &mt->entry ); list_add_tail( &package->mimes, &mt->entry );
...@@ -549,7 +543,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) ...@@ -549,7 +543,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
{ {
if (strcmpiW( clsid, cls->CLSID )) if (strcmpiW( clsid, cls->clsid ))
continue; continue;
if (strcmpW( context, cls->Context )) if (strcmpW( context, cls->Context ))
continue; continue;
...@@ -886,18 +880,18 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -886,18 +880,18 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_ADVERTISED ))) ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_ADVERTISED )))
{ {
TRACE("Skipping class %s reg due to disabled feature %s\n", TRACE("Skipping class %s reg due to disabled feature %s\n",
debugstr_w(cls->CLSID), debugstr_w(cls->clsid),
debugstr_w(feature->Feature)); debugstr_w(feature->Feature));
continue; continue;
} }
TRACE("Registering class %s (%p)\n", debugstr_w(cls->CLSID), cls); TRACE("Registering class %s (%p)\n", debugstr_w(cls->clsid), cls);
cls->Installed = TRUE; cls->Installed = TRUE;
mark_progid_for_install( package, cls->ProgID ); mark_progid_for_install( package, cls->ProgID );
RegCreateKeyW( hkey, cls->CLSID, &hkey2 ); RegCreateKeyW( hkey, cls->clsid, &hkey2 );
if (cls->Description) if (cls->Description)
RegSetValueExW( hkey2, NULL, 0, REG_SZ, (LPBYTE)cls->Description, RegSetValueExW( hkey2, NULL, 0, REG_SZ, (LPBYTE)cls->Description,
...@@ -1055,8 +1049,8 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -1055,8 +1049,8 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
if (ptr2) if (ptr2)
*ptr2 = 0; *ptr2 = 0;
keyname = HeapAlloc(GetProcessHeap(),0,(strlenW(szFileType_fmt)+ keyname = HeapAlloc(GetProcessHeap(),0,(strlenW(szFileType_fmt)+
strlenW(cls->CLSID) + 4) * sizeof(WCHAR)); strlenW(cls->clsid) + 4) * sizeof(WCHAR));
sprintfW( keyname, szFileType_fmt, cls->CLSID, index ); sprintfW( keyname, szFileType_fmt, cls->clsid, index );
RegCreateKeyW(HKEY_CLASSES_ROOT,keyname,&hkey2); RegCreateKeyW(HKEY_CLASSES_ROOT,keyname,&hkey2);
RegSetValueExW(hkey2,NULL,0,REG_SZ, (LPVOID)ptr, RegSetValueExW(hkey2,NULL,0,REG_SZ, (LPVOID)ptr,
...@@ -1075,7 +1069,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -1075,7 +1069,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
uirow = MSI_CreateRecord(1); uirow = MSI_CreateRecord(1);
MSI_RecordSetStringW( uirow, 1, cls->CLSID ); MSI_RecordSetStringW( uirow, 1, cls->clsid );
ui_actiondata(package,szRegisterClassInfo,uirow); ui_actiondata(package,szRegisterClassInfo,uirow);
msiobj_release(&uirow->hdr); msiobj_release(&uirow->hdr);
} }
...@@ -1105,11 +1099,11 @@ static UINT register_progid_base(MSIPACKAGE* package, MSIPROGID* progid, ...@@ -1105,11 +1099,11 @@ static UINT register_progid_base(MSIPACKAGE* package, MSIPROGID* progid,
if (progid->Class) if (progid->Class)
{ {
RegCreateKeyW(hkey,szCLSID,&hkey2); RegCreateKeyW(hkey,szCLSID,&hkey2);
RegSetValueExW( hkey2, NULL, 0, REG_SZ, (LPBYTE)progid->Class->CLSID, RegSetValueExW( hkey2, NULL, 0, REG_SZ, (LPBYTE)progid->Class->clsid,
(strlenW(progid->Class->CLSID)+1) * sizeof(WCHAR) ); (strlenW(progid->Class->clsid)+1) * sizeof(WCHAR) );
if (clsid) if (clsid)
strcpyW( clsid, progid->Class->CLSID ); strcpyW( clsid, progid->Class->clsid );
RegCloseKey(hkey2); RegCloseKey(hkey2);
} }
...@@ -1493,10 +1487,8 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) ...@@ -1493,10 +1487,8 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
HeapFree(GetProcessHeap(),0,extension); HeapFree(GetProcessHeap(),0,extension);
HeapFree(GetProcessHeap(),0,key); HeapFree(GetProcessHeap(),0,key);
if (mt->CLSID[0]) if (mt->clsid)
{
FIXME("Handle non null for field 3\n"); FIXME("Handle non null for field 3\n");
}
RegCloseKey(hkey); RegCloseKey(hkey);
......
...@@ -528,6 +528,8 @@ void ACTION_free_package_structures( MSIPACKAGE* package) ...@@ -528,6 +528,8 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSICLASS *cls = LIST_ENTRY( item, MSICLASS, entry ); MSICLASS *cls = LIST_ENTRY( item, MSICLASS, entry );
list_remove( &cls->entry ); list_remove( &cls->entry );
HeapFree( GetProcessHeap(), 0, cls->clsid );
HeapFree( GetProcessHeap(), 0, cls->Context );
HeapFree( GetProcessHeap(), 0, cls->Description ); HeapFree( GetProcessHeap(), 0, cls->Description );
HeapFree( GetProcessHeap(), 0, cls->FileTypeMask ); HeapFree( GetProcessHeap(), 0, cls->FileTypeMask );
HeapFree( GetProcessHeap(), 0, cls->IconPath ); HeapFree( GetProcessHeap(), 0, cls->IconPath );
...@@ -562,6 +564,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package) ...@@ -562,6 +564,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry ); MSIMIME *mt = LIST_ENTRY( item, MSIMIME, entry );
list_remove( &mt->entry ); list_remove( &mt->entry );
HeapFree( GetProcessHeap(), 0, mt->clsid );
HeapFree( GetProcessHeap(), 0, mt->ContentType ); HeapFree( GetProcessHeap(), 0, mt->ContentType );
HeapFree( GetProcessHeap(), 0, mt ); HeapFree( GetProcessHeap(), 0, mt );
} }
...@@ -571,6 +574,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package) ...@@ -571,6 +574,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
MSIAPPID *appid = LIST_ENTRY( item, MSIAPPID, entry ); MSIAPPID *appid = LIST_ENTRY( item, MSIAPPID, entry );
list_remove( &appid->entry ); list_remove( &appid->entry );
HeapFree( GetProcessHeap(), 0, appid->AppID );
HeapFree( GetProcessHeap(), 0, appid->RemoteServerName ); HeapFree( GetProcessHeap(), 0, appid->RemoteServerName );
HeapFree( GetProcessHeap(), 0, appid->LocalServer ); HeapFree( GetProcessHeap(), 0, appid->LocalServer );
HeapFree( GetProcessHeap(), 0, appid->ServiceParameters ); HeapFree( GetProcessHeap(), 0, appid->ServiceParameters );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment