Implement the advertise part of msiexec.

This commit is contained in:
Vincent Béron 2004-07-23 23:00:30 +00:00 committed by Alexandre Julliard
parent 0bb7b50f3d
commit 1dc308ec59
3 changed files with 85 additions and 17 deletions

View File

@ -113,6 +113,12 @@ typedef enum tagINSTALLLOGMODE
INSTALLLOGMODE_SHOWDIALOG = (1 << (INSTALLMESSAGE_SHOWDIALOG >> 24))
} INSTALLLOGMODE;
typedef enum tagADVERTISEFLAGS
{
ADVERTISEFLAGS_MACHINEASSIGN = 0,
ADVERTISEFLAGS_USERASSIGN = 1
} ADVERTISEFLAGS;
#define MAX_FEATURE_CHARS 38
typedef INT (CALLBACK *INSTALLUI_HANDLERA)(LPVOID pvContext, UINT iMessageType,

View File

@ -124,6 +124,7 @@ int main(int argc, char *argv[])
int i;
BOOL FunctionInstall = FALSE;
BOOL FunctionRepair = FALSE;
BOOL FunctionAdvertise = FALSE;
BOOL FunctionDllRegisterServer = FALSE;
BOOL FunctionDllUnregisterServer = FALSE;
@ -135,9 +136,14 @@ int main(int argc, char *argv[])
DWORD RepairMode = 0;
DWORD AdvertiseMode = 0;
LPSTR Transforms = HeapAlloc(GetProcessHeap(), 0, 1);
LANGID Language = 0;
LPSTR DllName = NULL;
Properties[0] = 0;
Transforms[0] = 0;
for(i = 1; i < argc; i++)
{
@ -262,40 +268,82 @@ int main(int argc, char *argv[])
}
else if(!strncasecmp(argv[i], "/j", 2))
{
int j;
int len = strlen(argv[i]);
FunctionAdvertise = TRUE;
for(j = 2; j < len; j++)
{
switch(argv[i][j])
{
case 'U':
case 'u':
AdvertiseMode = ADVERTISEFLAGS_USERASSIGN;
break;
case 'M':
case 'm':
AdvertiseMode = ADVERTISEFLAGS_MACHINEASSIGN;
break;
default:
fprintf(stderr, "Unknown option \"%c\" in Advertise mode\n", argv[i][j]);
break;
}
}
i++;
if(i >= argc)
ShowUsage(1);
WINE_FIXME("Advertising not yet implemented\n");
ExitProcess(1);
PackageName = argv[i];
}
else if(!strcasecmp(argv[i], "u") || !strcasecmp(argv[i], "m"))
else if(!strcasecmp(argv[i], "u"))
{
FunctionAdvertise = TRUE;
AdvertiseMode = ADVERTISEFLAGS_USERASSIGN;
i++;
if(i >= argc)
ShowUsage(1);
WINE_FIXME("Advertising not yet implemented\n");
ExitProcess(1);
PackageName = argv[i];
}
else if(!strcasecmp(argv[i], "m"))
{
FunctionAdvertise = TRUE;
AdvertiseMode = ADVERTISEFLAGS_MACHINEASSIGN;
i++;
if(i >= argc)
ShowUsage(1);
PackageName = argv[i];
}
else if(!strcasecmp(argv[i], "/t"))
{
i++;
if(i >= argc)
ShowUsage(1);
WINE_FIXME("Transforms not yet implemented\n");
ExitProcess(1);
TempStr = HeapReAlloc(GetProcessHeap(), 0, Transforms, HeapSize(GetProcessHeap(), 0, Transforms)+strlen(argv[i])+1);
if(!TempStr)
{
WINE_ERR("Out of memory!\n");
ExitProcess(1);
}
Transforms = TempStr;
strcat(Transforms, argv[i]);
strcat(Transforms, ";");
}
else if(!strncasecmp(argv[i], "TRANSFORMS", 10))
else if(!strncasecmp(argv[i], "TRANSFORMS=", 11))
{
WINE_FIXME("Transforms not yet implemented\n");
ExitProcess(1);
TempStr = HeapReAlloc(GetProcessHeap(), 0, Transforms, HeapSize(GetProcessHeap(), 0, Transforms)+strlen(argv[i])+1-11);
if(!TempStr)
{
WINE_ERR("Out of memory!\n");
ExitProcess(1);
}
Transforms = TempStr;
strcat(Transforms, argv[i]+11);
strcat(Transforms, ";");
}
else if(!strcasecmp(argv[i], "/g"))
{
i++;
if(i >= argc)
ShowUsage(1);
WINE_FIXME("Language ID not yet implemented\n");
ExitProcess(1);
Language = strtol(argv[i], NULL, 0);
}
else if(!strncasecmp(argv[i], "/l", 2))
{
@ -354,6 +402,17 @@ int main(int argc, char *argv[])
}
Properties = TempStr;
}
if(Transforms[strlen(Transforms)-1] == ';')
{
Transforms[strlen(Transforms)-1] = 0;
TempStr = HeapReAlloc(GetProcessHeap(), 0, Transforms, HeapSize(GetProcessHeap(), 0, Transforms)-1);
if(!TempStr)
{
fprintf(stderr, "Out of memory!\n");
ExitProcess(1);
}
Transforms = TempStr;
}
if(FunctionInstall)
{
@ -387,6 +446,14 @@ int main(int argc, char *argv[])
}
}
}
else if(FunctionAdvertise)
{
if(MsiAdvertiseProductA(PackageName, (LPSTR) AdvertiseMode, Transforms, Language) != ERROR_SUCCESS)
{
fprintf(stderr, "Advertising of %s (%lu, %s, 0x%04x) failed.\n", PackageName, AdvertiseMode, Transforms, Language);
ExitProcess(1);
}
}
else if(FunctionDllRegisterServer)
{
DllRegisterServer(DllName);

View File

@ -21,11 +21,6 @@
typedef HRESULT (*DLLREGISTERSERVER)(void);
typedef HRESULT (*DLLUNREGISTERSERVER)(void);
/* Advertising flags */
#define ADVERTISE_CURRENT_USER 0x00000001
#define ADVERTISE_ALL_USERS 0x00000002
/* Logging flags */
#define LOG_STATUS_MESSAGES 0x00000001