183 lines
5.8 KiB
C
183 lines
5.8 KiB
C
//
|
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
|
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
|
// PARTICULAR PURPOSE.
|
|
//
|
|
// Copyright (c) Microsoft Corporation. All rights reserved
|
|
//
|
|
|
|
#include <MI.h>
|
|
#include "MSFT_WindowsService.h"
|
|
#include "WindowsService.h"
|
|
|
|
void MI_CALL MSFT_WindowsService_Load(
|
|
_Outptr_result_maybenull_ MSFT_WindowsService_Self** self,
|
|
_In_opt_ MI_Module_Self* selfModule,
|
|
_In_ MI_Context* context)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(selfModule);
|
|
|
|
*self = NULL;
|
|
MI_Context_PostResult(context, MI_RESULT_OK);
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_Unload(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
|
|
MI_Context_PostResult(context, MI_RESULT_OK);
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_EnumerateInstances(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_opt_ const MI_PropertySet* propertySet,
|
|
_In_ MI_Boolean keysOnly,
|
|
_In_opt_ const MI_Filter* filter)
|
|
{
|
|
MI_Result result;
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(propertySet);
|
|
MI_UNREFERENCED_PARAMETER(keysOnly);
|
|
MI_UNREFERENCED_PARAMETER(filter);
|
|
|
|
result = EnumerateServices(context, keysOnly);
|
|
|
|
MI_Context_PostResult(context, result);
|
|
/* Provider should not use the context after posting the result */
|
|
}
|
|
|
|
/* GetInstance if successful must post the result instance */
|
|
void MI_CALL MSFT_WindowsService_GetInstance(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_ const MSFT_WindowsService* instanceName,
|
|
_In_opt_ const MI_PropertySet* propertySet)
|
|
{
|
|
MI_Result result;
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(instanceName);
|
|
MI_UNREFERENCED_PARAMETER(propertySet);
|
|
|
|
result = GetServiceInstance(context, instanceName);
|
|
|
|
MI_Context_PostResult(context, result);
|
|
/* Provider should not use the context after posting the result */
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_CreateInstance(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_ const MSFT_WindowsService* newInstance)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(newInstance);
|
|
|
|
MI_Context_PostResult(context, MI_RESULT_NOT_SUPPORTED);
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_ModifyInstance(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_ const MSFT_WindowsService* modifiedInstance,
|
|
_In_opt_ const MI_PropertySet* propertySet)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(modifiedInstance);
|
|
MI_UNREFERENCED_PARAMETER(propertySet);
|
|
|
|
MI_Context_PostResult(context, MI_RESULT_NOT_SUPPORTED);
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_DeleteInstance(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_ const MSFT_WindowsService* instanceName)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(instanceName);
|
|
|
|
MI_Context_PostResult(context, MI_RESULT_NOT_SUPPORTED);
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_Invoke_RequestStateChange(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_opt_z_ const MI_Char* methodName,
|
|
_In_ const MSFT_WindowsService* instanceName,
|
|
_In_opt_ const MSFT_WindowsService_RequestStateChange* in)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(methodName);
|
|
MI_UNREFERENCED_PARAMETER(instanceName);
|
|
MI_UNREFERENCED_PARAMETER(in);
|
|
|
|
MI_Context_PostResult(context, MI_RESULT_NOT_SUPPORTED);
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_Invoke_StartService(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_opt_z_ const MI_Char* methodName,
|
|
_In_ const MSFT_WindowsService* instanceName,
|
|
_In_opt_ const MSFT_WindowsService_StartService* in)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(methodName);
|
|
MI_UNREFERENCED_PARAMETER(instanceName);
|
|
MI_UNREFERENCED_PARAMETER(in);
|
|
|
|
Invoke_StartService(context, instanceName);
|
|
}
|
|
|
|
void MI_CALL MSFT_WindowsService_Invoke_StopService(
|
|
_In_opt_ MSFT_WindowsService_Self* self,
|
|
_In_ MI_Context* context,
|
|
_In_opt_z_ const MI_Char* nameSpace,
|
|
_In_opt_z_ const MI_Char* className,
|
|
_In_opt_z_ const MI_Char* methodName,
|
|
_In_ const MSFT_WindowsService* instanceName,
|
|
_In_opt_ const MSFT_WindowsService_StopService* in)
|
|
{
|
|
MI_UNREFERENCED_PARAMETER(self);
|
|
MI_UNREFERENCED_PARAMETER(nameSpace);
|
|
MI_UNREFERENCED_PARAMETER(className);
|
|
MI_UNREFERENCED_PARAMETER(methodName);
|
|
MI_UNREFERENCED_PARAMETER(instanceName);
|
|
MI_UNREFERENCED_PARAMETER(in);
|
|
|
|
Invoke_StopService(context, instanceName);
|
|
}
|
|
|