Sync with trunk head

svn path=/branches/header-work/; revision=46021
This commit is contained in:
Amine Khaldi 2010-03-09 00:19:55 +00:00
commit a00acb2a1b
1006 changed files with 161728 additions and 16722 deletions

View file

@ -47,6 +47,7 @@ static const char UsageStr[] =
" Install a product:\n"
" msiexec {package|productcode} [property]\n"
" msiexec /i {package|productcode} [property]\n"
" msiexec /package {package|productcode} [property]\n"
" msiexec /a package [property]\n"
" Repair an installation:\n"
" msiexec /f[p|o|e|d|c|a|u|m|s|v] {package|productcode}\n"
@ -562,12 +563,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
{
FunctionUnregServer = TRUE;
}
else if(msi_option_prefix(argvW[i], "i"))
else if(msi_option_prefix(argvW[i], "i") || msi_option_prefix(argvW[i], "package"))
{
LPWSTR argvWi = argvW[i];
int argLen = (msi_option_prefix(argvW[i], "i") ? 2 : 8);
FunctionInstall = TRUE;
if(lstrlenW(argvWi) > 2)
argvWi += 2;
if(lstrlenW(argvW[i]) > argLen)
argvWi += argLen;
else
{
i++;

View file

@ -12,7 +12,6 @@
<library>ole32</library>
<library>msi</library>
<file>msiexec.c</file>
<file>rsrc.rc</file>
<file>service.c</file>
<file>version.rc</file>
<file>rsrc.rc</file>
</module>

View file

@ -18,7 +18,16 @@
#include <windows.h>
#include "version.rc"
#define WINE_FILEDESCRIPTION_STR "Wine Installer"
#define WINE_FILENAME_STR "msiexec.exe"
#define WINE_FILETYPE VFT_APP
#define WINE_FILEVERSION 3,1,4000,1823
#define WINE_FILEVERSION_STR "3.1.4000.1823"
#define WINE_PRODUCTVERSION 3,1,4000,1823
#define WINE_PRODUCTVERSION_STR "3.1.4000.1823"
#define WINE_PRODUCTNAME_STR "Wine Installer"
#include "wine/wine_common_ver.rc"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL

View file

@ -1,28 +0,0 @@
/*
* Copyright (c) 2004 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine Installer"
#define WINE_FILENAME_STR "msiexec.exe"
#define WINE_FILETYPE VFT_APP
#define WINE_FILEVERSION 3,1,4000,1823
#define WINE_FILEVERSION_STR "3.1.4000.1823"
#define WINE_PRODUCTVERSION 3,1,4000,1823
#define WINE_PRODUCTVERSION_STR "3.1.4000.1823"
#define WINE_PRODUCTNAME_STR "Wine Installer"
#include "wine/wine_common_ver.rc"

View file

@ -121,37 +121,6 @@ ScmGetServiceEntryByResumeCount(DWORD dwResumeCount)
}
PSERVICE
ScmGetServiceEntryByClientHandle(HANDLE Handle)
{
PLIST_ENTRY ServiceEntry;
PSERVICE CurrentService;
DPRINT("ScmGetServiceEntryByClientHandle() called\n");
DPRINT("looking for %p\n", Handle);
ServiceEntry = ServiceListHead.Flink;
while (ServiceEntry != &ServiceListHead)
{
CurrentService = CONTAINING_RECORD(ServiceEntry,
SERVICE,
ServiceListEntry);
if (CurrentService->hClient == Handle)
{
DPRINT("Found service: '%S'\n", CurrentService->lpDisplayName);
return CurrentService;
}
ServiceEntry = ServiceEntry->Flink;
}
DPRINT("Couldn't find a matching service\n");
return NULL;
}
DWORD
ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
PSERVICE *lpServiceRecord)
@ -710,12 +679,15 @@ ScmGetBootAndSystemDriverState(VOID)
DWORD
ScmControlService(PSERVICE Service,
DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus)
DWORD dwControl)
{
PSCM_CONTROL_PACKET ControlPacket;
DWORD Count;
SCM_REPLY_PACKET ReplyPacket;
DWORD dwWriteCount = 0;
DWORD dwReadCount = 0;
DWORD TotalLength;
DWORD dwError = ERROR_SUCCESS;
DPRINT("ScmControlService() called\n");
@ -728,31 +700,37 @@ ScmControlService(PSERVICE Service,
return ERROR_NOT_ENOUGH_MEMORY;
ControlPacket->dwControl = dwControl;
ControlPacket->hClient = Service->hClient;
ControlPacket->dwSize = TotalLength;
ControlPacket->hServiceStatus = (SERVICE_STATUS_HANDLE)Service;
wcscpy(&ControlPacket->szArguments[0], Service->lpServiceName);
/* Send the control packet */
WriteFile(Service->ControlPipeHandle,
ControlPacket,
sizeof(SCM_CONTROL_PACKET) + (TotalLength * sizeof(WCHAR)),
&Count,
&dwWriteCount,
NULL);
/* FIXME: Read the reply */
/* Read the reply */
ReadFile(Service->ControlPipeHandle,
&ReplyPacket,
sizeof(SCM_REPLY_PACKET),
&dwReadCount,
NULL);
/* Release the contol packet */
HeapFree(GetProcessHeap(),
0,
ControlPacket);
RtlCopyMemory(lpServiceStatus,
&Service->Status,
sizeof(SERVICE_STATUS));
if (dwReadCount == sizeof(SCM_REPLY_PACKET))
{
dwError = ReplyPacket.dwError;
}
DPRINT("ScmControlService) done\n");
DPRINT("ScmControlService() done\n");
return ERROR_SUCCESS;
return dwError;
}
@ -762,11 +740,15 @@ ScmSendStartCommand(PSERVICE Service,
LPWSTR *argv)
{
PSCM_CONTROL_PACKET ControlPacket;
SCM_REPLY_PACKET ReplyPacket;
DWORD TotalLength;
DWORD ArgsLength = 0;
DWORD Length;
PWSTR Ptr;
DWORD Count;
DWORD dwWriteCount = 0;
DWORD dwReadCount = 0;
DWORD dwError = ERROR_SUCCESS;
DWORD i;
DPRINT("ScmSendStartCommand() called\n");
@ -774,10 +756,10 @@ ScmSendStartCommand(PSERVICE Service,
TotalLength = wcslen(Service->lpServiceName) + 1;
if (argc > 0)
{
for (Count = 0; Count < argc; Count++)
for (i = 0; i < argc; i++)
{
DPRINT("Arg: %S\n", argv[Count]);
Length = wcslen(argv[Count]) + 1;
DPRINT("Arg: %S\n", argv[i]);
Length = wcslen(argv[i]) + 1;
TotalLength += Length;
ArgsLength += Length;
}
@ -793,7 +775,7 @@ ScmSendStartCommand(PSERVICE Service,
return ERROR_NOT_ENOUGH_MEMORY;
ControlPacket->dwControl = SERVICE_CONTROL_START;
ControlPacket->hClient = Service->hClient;
ControlPacket->hServiceStatus = (SERVICE_STATUS_HANDLE)Service;
ControlPacket->dwSize = TotalLength;
Ptr = &ControlPacket->szArguments[0];
wcscpy(Ptr, Service->lpServiceName);
@ -817,19 +799,29 @@ ScmSendStartCommand(PSERVICE Service,
WriteFile(Service->ControlPipeHandle,
ControlPacket,
sizeof(SCM_CONTROL_PACKET) + (TotalLength - 1) * sizeof(WCHAR),
&Count,
&dwWriteCount,
NULL);
/* FIXME: Read the reply */
/* Read the reply */
ReadFile(Service->ControlPipeHandle,
&ReplyPacket,
sizeof(SCM_REPLY_PACKET),
&dwReadCount,
NULL);
/* Release the contol packet */
HeapFree(GetProcessHeap(),
0,
ControlPacket);
if (dwReadCount == sizeof(SCM_REPLY_PACKET))
{
dwError = ReplyPacket.dwError;
}
DPRINT("ScmSendStartCommand() done\n");
return ERROR_SUCCESS;
return dwError;
}
@ -850,6 +842,7 @@ ScmStartUserModeService(PSERVICE Service,
WCHAR NtControlPipeName[MAX_PATH + 1];
HKEY hServiceCurrentKey = INVALID_HANDLE_VALUE;
DWORD KeyDisposition;
DWORD dwProcessId;
RtlInitUnicodeString(&ImagePath, NULL);
@ -991,7 +984,7 @@ ScmStartUserModeService(PSERVICE Service,
/* Read SERVICE_STATUS_HANDLE from pipe */
if (!ReadFile(Service->ControlPipeHandle,
(LPVOID)&Service->hClient,
(LPVOID)&dwProcessId,
sizeof(DWORD),
&dwRead,
NULL))
@ -1002,7 +995,7 @@ ScmStartUserModeService(PSERVICE Service,
}
else
{
DPRINT("Received service status %lu\n", Service->hClient);
DPRINT("Received service process ID %lu\n", dwProcessId);
/* Send start command */
dwError = ScmSendStartCommand(Service, argc, argv);
@ -1222,7 +1215,6 @@ ScmAutoShutdownServices(VOID)
{
PLIST_ENTRY ServiceEntry;
PSERVICE CurrentService;
SERVICE_STATUS ServiceStatus;
DPRINT("ScmAutoShutdownServices() called\n");
@ -1235,7 +1227,7 @@ ScmAutoShutdownServices(VOID)
CurrentService->Status.dwCurrentState == SERVICE_START_PENDING)
{
/* shutdown service */
ScmControlService(CurrentService, SERVICE_CONTROL_STOP, &ServiceStatus);
ScmControlService(CurrentService, SERVICE_CONTROL_STOP);
}
ServiceEntry = ServiceEntry->Flink;
@ -1244,4 +1236,25 @@ ScmAutoShutdownServices(VOID)
DPRINT("ScmGetBootAndSystemDriverState() done\n");
}
BOOL
ScmLockDatabaseExclusive(VOID)
{
return RtlAcquireResourceExclusive(&DatabaseLock, TRUE);
}
BOOL
ScmLockDatabaseShared(VOID)
{
return RtlAcquireResourceShared(&DatabaseLock, TRUE);
}
VOID
ScmUnlockDatabase(VOID)
{
RtlReleaseResource(&DatabaseLock);
}
/* EOF */

View file

@ -637,8 +637,12 @@ DWORD RControlService(
{
/* Send control code to the service */
dwError = ScmControlService(lpService,
dwControl,
lpServiceStatus);
dwControl);
/* Return service status information */
RtlCopyMemory(lpServiceStatus,
&lpService->Status,
sizeof(SERVICE_STATUS));
}
if ((dwError == ERROR_SUCCESS) && (pcbBytesNeeded))
@ -652,10 +656,6 @@ DWORD RControlService(
lpService->ThreadId = 0;
}
/* Return service status information */
RtlCopyMemory(lpServiceStatus,
&lpService->Status,
sizeof(SERVICE_STATUS));
return dwError;
}
@ -978,11 +978,15 @@ DWORD RQueryServiceStatus(
return ERROR_INVALID_HANDLE;
}
ScmLockDatabaseShared();
/* Return service status information */
RtlCopyMemory(lpServiceStatus,
&lpService->Status,
sizeof(SERVICE_STATUS));
ScmUnlockDatabase();
return ERROR_SUCCESS;
}
@ -1030,7 +1034,7 @@ DWORD RSetServiceStatus(
return ERROR_INVALID_HANDLE;
}
lpService = ScmGetServiceEntryByClientHandle((HANDLE)hServiceStatus);
lpService = (PSERVICE)hServiceStatus;
if (lpService == NULL)
{
DPRINT("lpService == NULL!\n");
@ -1059,11 +1063,14 @@ DWORD RSetServiceStatus(
return ERROR_INVALID_DATA;
}
ScmLockDatabaseExclusive();
RtlCopyMemory(&lpService->Status,
lpServiceStatus,
sizeof(SERVICE_STATUS));
ScmUnlockDatabase();
DPRINT("Set %S to %lu\n", lpService->lpDisplayName, lpService->Status.dwCurrentState);
DPRINT("RSetServiceStatus() done\n");

View file

@ -42,7 +42,6 @@ typedef struct _SERVICE
DWORD dwResumeCount;
DWORD dwRefCount;
CLIENT_HANDLE hClient;
SERVICE_STATUS Status;
DWORD dwStartType;
DWORD dwErrorControl;
@ -112,15 +111,18 @@ DWORD ScmStartService(PSERVICE Service,
PSERVICE ScmGetServiceEntryByName(LPCWSTR lpServiceName);
PSERVICE ScmGetServiceEntryByDisplayName(LPCWSTR lpDisplayName);
PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
PSERVICE ScmGetServiceEntryByClientHandle(HANDLE Handle);
DWORD ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
PSERVICE *lpServiceRecord);
VOID ScmDeleteServiceRecord(PSERVICE lpService);
DWORD ScmMarkServiceForDelete(PSERVICE pService);
DWORD ScmControlService(PSERVICE Service,
DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus);
DWORD dwControl);
BOOL ScmLockDatabaseExclusive(VOID);
BOOL ScmLockDatabaseShared(VOID);
VOID ScmUnlockDatabase(VOID);
/* driver.c */

View file

@ -1,4 +1,5 @@
#pragma once
#ifndef _SMSS_H_INCLUDED_
#define _SMSS_H_INCLUDED_
#include <stdio.h>
#include <stdlib.h>
@ -112,4 +113,7 @@ NTSTATUS SmInitializeDbgSs(VOID);
VOID NTAPI DisplayString(LPCWSTR lpwString);
VOID NTAPI PrintString (char* fmt, ...);
#endif /* _SMSS_H_INCLUDED_ */
/* EOF */