void MI_CALL TEST_Test3User_CreateInstance( _In_opt_ TEST_Test3User_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const TEST_Test3User* 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_WindowsServiceProcess_CreateInstance( _In_opt_ MSFT_WindowsServiceProcess_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const MSFT_WindowsServiceProcess* 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_nxUserResource_DeleteInstance( _In_opt_ MSFT_nxUserResource_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const MSFT_nxUserResource* 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_FileDirectoryConfiguration_CreateInstance( _In_opt_ MSFT_FileDirectoryConfiguration_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const MSFT_FileDirectoryConfiguration* 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_FileDirectoryConfiguration_ModifyInstance( _In_opt_ MSFT_FileDirectoryConfiguration_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const MSFT_FileDirectoryConfiguration* 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_WindowsServiceProcess_ModifyInstance( _In_opt_ MSFT_WindowsServiceProcess_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const MSFT_WindowsServiceProcess* 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_nxGroupResource_GetInstance( _In_opt_ MSFT_nxGroupResource_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const MSFT_nxGroupResource* instanceName, _In_opt_ const MI_PropertySet* propertySet) { MI_UNREFERENCED_PARAMETER(self); MI_UNREFERENCED_PARAMETER(nameSpace); MI_UNREFERENCED_PARAMETER(className); MI_UNREFERENCED_PARAMETER(instanceName); MI_UNREFERENCED_PARAMETER(propertySet); MI_Context_PostResult(context, MI_RESULT_NOT_SUPPORTED); }
void MI_CALL TEST_Test3User_ModifyInstance( _In_opt_ TEST_Test3User_Self* self, _In_ MI_Context* context, _In_opt_z_ const MI_Char* nameSpace, _In_opt_z_ const MI_Char* className, _In_ const TEST_Test3User* 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_nxServiceResource_Load( _Outptr_result_maybenull_ MSFT_nxServiceResource_Self** self, _In_opt_ MI_Module_Self* selfModule, _In_ MI_Context* context) { MI_UNREFERENCED_PARAMETER(selfModule); MI_Result res = MI_RESULT_OK; if (EXIT_SUCCESS != MSFT_nxServiceResource_Self::create (self)) { res = MI_RESULT_FAILED; } MI_Context_PostResult(context, res); }
void MI_CALL TEST_Test3User_EnumerateInstances( _In_opt_ TEST_Test3User_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_UNREFERENCED_PARAMETER(self); MI_UNREFERENCED_PARAMETER(nameSpace); MI_UNREFERENCED_PARAMETER(className); MI_UNREFERENCED_PARAMETER(propertySet); MI_UNREFERENCED_PARAMETER(keysOnly); MI_UNREFERENCED_PARAMETER(filter); MI_Context_PostResult(context, MI_RESULT_NOT_SUPPORTED); }
void MI_CALL MSFT_DSCLocalConfigManager_Unload( _In_opt_ MSFT_DSCLocalConfigManager_Self* self, _In_ MI_Context* context) { MI_Result miResult; MI_Instance *cimErrorDetails = NULL; MI_UNREFERENCED_PARAMETER(self); miResult = UnInitHandler(&cimErrorDetails); if(miResult != MI_RESULT_OK) { MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); return; } MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL MSFT_DSCLocalConfigManager_Invoke_Resume( _In_opt_ MSFT_DSCLocalConfigManager_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_DSCLocalConfigManager* instanceName, _In_opt_ const MSFT_DSCLocalConfigManager_Resume* 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_nxGroupResource_Invoke_GetTargetResource( _In_opt_ MSFT_nxGroupResource_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_nxGroupResource* instanceName, _In_opt_ const MSFT_nxGroupResource_GetTargetResource* in) { SCX_BOOKEND_EX ("Get", " name=\"nxGroup\""); MI_Result result = MI_RESULT_FAILED; if (self) { MI_Instance* retInstance; MI_Instance_Clone (&in->InputResource.value->__instance, &retInstance); result = self->get (in->InputResource.value->__instance, context, retInstance); if (MI_RESULT_OK == result) { SCX_BOOKEND_PRINT ("packing succeeded!"); MSFT_nxGroupResource_GetTargetResource out; MSFT_nxGroupResource_GetTargetResource_Construct (&out, context); MSFT_nxGroupResource_GetTargetResource_Set_MIReturn (&out, 0); MI_Value value; value.instance = retInstance; MI_Instance_SetElement (&out.__instance, "OutputResource", &value, MI_INSTANCE, 0); result = MSFT_nxGroupResource_GetTargetResource_Post (&out, context); if (MI_RESULT_OK != result) { SCX_BOOKEND_PRINT ("post Failed"); } MSFT_nxGroupResource_GetTargetResource_Destruct (&out); } else { SCX_BOOKEND_PRINT ("get FAILED"); } MI_Instance_Delete (retInstance); } MI_Context_PostResult (context, result); }
void MI_CALL MSFT_WindowsServiceManager_Invoke_GetWindowsServices( _In_opt_ MSFT_WindowsServiceManager_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_WindowsServiceManager* instanceName, _In_opt_ const MSFT_WindowsServiceManager_GetWindowsServices* in) { MI_Result result; MI_UNREFERENCED_PARAMETER(self); MI_UNREFERENCED_PARAMETER(nameSpace); MI_UNREFERENCED_PARAMETER(className); MI_UNREFERENCED_PARAMETER(methodName); MI_UNREFERENCED_PARAMETER(instanceName); result = Invoke_GetWindowsServices(context, in); MI_Context_PostResult(context, result); }
void MI_CALL MSFT_DSCLocalConfigurationManager_Invoke_SendConfiguration( _In_opt_ MSFT_DSCLocalConfigurationManager_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_DSCLocalConfigurationManager* instanceName, _In_opt_ const MSFT_DSCLocalConfigurationManager_SendConfiguration* in) { SetJobId(); // Debug Log DSC_EventWriteMSFTMethodParameters(__WFUNCTION__,className,methodName,nameSpace); if (!in || !in->ConfigurationData.exists) { MI_Context_PostResult(context, MI_RESULT_INVALID_PARAMETER); ResetJobId(); return; } Invoke_SendConfiguration(self, context, nameSpace, className, methodName, instanceName, in); }
void MI_CALL MSFT_DSCLocalConfigurationManager_Invoke_PerformRequiredConfigurationChecks( _In_opt_ MSFT_DSCLocalConfigurationManager_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_DSCLocalConfigurationManager* instanceName, _In_opt_ const MSFT_DSCLocalConfigurationManager_PerformRequiredConfigurationChecks* in) { SetJobId(); // Debug Log DSC_EventWriteMSFTMethodParameters(__WFUNCTION__,className,methodName,nameSpace); if (!in->Flags.exists || !(in->Flags.value == TASK_REGULAR || in->Flags.value == TASK_REBOOT || in->Flags.value == TASK_BOOTSTRAP )) { MI_Context_PostResult(context, MI_RESULT_INVALID_PARAMETER); ResetJobId(); return; } Invoke_PerformRequiredConfigurationChecks(self, context, nameSpace, className, methodName, instanceName, in); }
void MI_CALL MSFT_DSCLocalConfigManager_Load( _Outptr_result_maybenull_ MSFT_DSCLocalConfigManager_Self** self, _In_opt_ MI_Module_Self* selfModule, _In_ MI_Context* context) { MI_Result miResult; MI_Instance *cimErrorDetails = NULL; MI_UNREFERENCED_PARAMETER(selfModule); *self = NULL; //load will not be called by multiple threads miResult = InitHandler(&cimErrorDetails); if(miResult != MI_RESULT_OK) { MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); return; } MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL TEST_Stop_Invoke_TestTargetResource( _In_opt_ TEST_Stop_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 TEST_Stop* instanceName, _In_opt_ const TEST_Stop_TestTargetResource* in) { TEST_Stop_TestTargetResource out; MI_UNREFERENCED_PARAMETER(self); MI_UNREFERENCED_PARAMETER(nameSpace); MI_UNREFERENCED_PARAMETER(className); MI_UNREFERENCED_PARAMETER(methodName); MI_UNREFERENCED_PARAMETER(instanceName); MI_UNREFERENCED_PARAMETER(in); TEST_Stop_TestTargetResource_Construct(&out, context); TEST_Stop_TestTargetResource_Set_Result(&out,MI_FALSE); TEST_Stop_TestTargetResource_Set_MIReturn(&out, 0 ); MI_Context_PostInstance(context, &(out.__instance)); TEST_Stop_TestTargetResource_Destruct(&out); MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL Gadget_Unload( Gadget_Self* self, MI_Context* context) { MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL Unload(_In_opt_ MI_Module_Self* self, _In_ struct _MI_Context* context) { MI_UNREFERENCED_PARAMETER(self); MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL Load(_Outptr_result_maybenull_ MI_Module_Self** self, _In_ struct _MI_Context* context) { *self = NULL; MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL MSFT_nxGroupResource_Invoke_InventoryTargetResource( _In_opt_ MSFT_nxGroupResource_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_nxGroupResource* instanceName, _In_opt_ const MSFT_nxGroupResource_InventoryTargetResource* in) { SCX_BOOKEND_EX ("Inventory", " name=\"nxGroup\""); MI_Result result = MI_RESULT_FAILED; if (self) { MI_Instance* retInstance; MI_NewDynamicInstance ( context, className, 0, &retInstance); result = self->inventory (in->InputResource.value->__instance, context, retInstance); if (MI_RESULT_OK == result) { SCX_BOOKEND_PRINT ("packing succeeded!"); MSFT_nxGroupResource_InventoryTargetResource out; MSFT_nxGroupResource_InventoryTargetResource_Construct (&out, context); MSFT_nxGroupResource_InventoryTargetResource_Set_MIReturn (&out, 0); { const MI_Uint32 c_initBufferLength = 1000000; MI_Application application; MI_Serializer serializer; MI_Uint8 *clientBuffer; MI_Uint32 clientBufferLength = c_initBufferLength; MI_Uint32 clientBufferNeeded = 0; const char * reportTemplateBase = DSC_ETC_PATH "/InventoryReports/nxGroup_XXXXXX"; FILE *fp = NULL; clientBuffer = (MI_Uint8*)malloc(clientBufferLength + 1); MI_Application_Initialize(0,NULL,NULL, &application); result = XmlSerializer_Create(&application, 0, "MI_XML", &serializer); if (result != MI_RESULT_OK) { MI_Application_Close(&application); MI_Context_PostResult (context, result); return; } result = XmlSerializer_SerializeInstance( &serializer, 0, retInstance, clientBuffer, clientBufferLength, &clientBufferNeeded); if (result != MI_RESULT_OK) { free(clientBuffer); if (clientBufferNeeded > 0) { // Try again with a buffer given to us by the clientBufferNeeded field clientBufferLength = clientBufferNeeded; clientBuffer = (MI_Uint8*)malloc(clientBufferLength + 1); result = XmlSerializer_SerializeInstance( &serializer, 0, retInstance, clientBuffer, clientBufferLength, &clientBufferNeeded); } else { XmlSerializer_Close(&serializer); MI_Application_Close(&application); MI_Context_PostResult (context, result); return; } } XmlSerializer_Close(&serializer); MI_Application_Close(&application); if (result == MI_RESULT_OK) { clientBuffer[clientBufferNeeded] = '\0'; printf((char*)clientBuffer); } { char * reportTemplate = (char*)malloc(strlen(reportTemplateBase)); strcpy(reportTemplate, reportTemplateBase); int fd = mkstemp(reportTemplate); if (fd == -1) { std::cerr << std::endl << "Error running mkstemp, errno = " << errno << std::endl; } fp = fdopen(fd, "w"); if( fp != NULL ) { fwrite(clientBuffer, 1, clientBufferNeeded, fp); fclose(fp); } else { std::cerr << std::endl << "Error opening file descriptor for reportTemplate, errno = " << errno << std::endl; } free(reportTemplate); } free(clientBuffer); } result = MSFT_nxGroupResource_InventoryTargetResource_Post (&out, context); if (MI_RESULT_OK != result) { SCX_BOOKEND_PRINT ("post Failed"); } MSFT_nxGroupResource_InventoryTargetResource_Destruct (&out); } else { SCX_BOOKEND_PRINT ("inventory FAILED"); } MI_Instance_Delete (retInstance); } MI_Context_PostResult (context, result); }
void MI_CALL CIM_VLANEndpoint_Unload( CIM_VLANEndpoint_Self* self, MI_Context* context) { MI_Context_PostResult(context, MI_RESULT_OK); }
PAL_Uint32 THREAD_API fireindication(void* param) { Config* config = (Config*)param; MI_Result r = MI_RESULT_OK; MI_Uint32 failAfterCount = config->failAfterCount; MI_Result failResult = config->failResult; Atomic_Swap( &config->threadrunning, 1); LOGMSG(("Set threadrunning to 1 for config (%p)", config)); config->count = 0; LOGMSG(("Start to fireindication for class (%s)", config->className)); /* wait for the semaphore */ LOGMSG(("Wait for semaphore to fire indication")); Sem_Wait(&config->sem); LOGMSG(("Received semaphore and start firing indication")); if (config->testGroup == (MI_Uint32)TestGroup_Misc) { switch (config->miscTestSubGroup) { case MiscTestGroup_GetExpression: case MiscTestGroup_Evaluate: case MiscTestGroup_SelfTest: failAfterCount = 1; failResult = MI_RESULT_FAILED; break; default: break; } } while((MI_FALSE == config->disabled) && (config->count < failAfterCount)) { config->count++; if (config->intervalMS > 0) { Sleep_Milliseconds(config->intervalMS); } if (r!= MI_RESULT_OK) { LOGMSG(("Set property value of indication failed (%d); Ignore #%d indication", r, config->count)); continue; } if (config->lifecycleThreadControl == 0) { const MI_Char* bookmark = NULL; DEBUG_ASSERT( NULL != config->setprop ); r = config->setprop(config->context, &config->indication); if (r == MI_RESULT_OK) { DEBUG_ASSERT( NULL != config->indication ); if (config->subscribeBookmark && 0 < Strlen(config->subscribeBookmark) && 0 != Strcmp(config->subscribeBookmark, ".")) { // Only set bookmark if it is non-NULL and non-default bookmark = ansiToMI(config->subscribeBookmark); } r = MI_Context_PostIndication(config->postctx, config->indication, 0, bookmark); if (r!= MI_RESULT_OK) { LOGMSG(("Post #%d Indication failed (%d)", config->count, r)); } /* Delete indication instance */ MI_Instance_Delete( config->indication ); config->indication = NULL; } else { LOGMSG(("config(%p:%s)->setprop failed to create indication instance(%d)", config, config->className, r)); } } else { if (config->lifecycleContext && config->currentSubscriptionTypes != 0 && config->supportedSubscriptionTypes != 0) { // lifeCycleThreadControl other than 0 and a running thread indicates that we should schedule lifecycle events if (config->lifecycleThreadControl & MI_LIFECYCLE_INDICATION_CREATE) { r = lifecycle_CreateInstance(config, config->lifecycleInstance); if (r != MI_RESULT_OK) { LOGMSG(("Lifecycle_CreateInstance for class (%s) failed with result (%d)", config->className, r)); } } if (config->lifecycleThreadControl & MI_LIFECYCLE_INDICATION_MODIFY) { r = lifecycle_ModifyInstance(config->lifecycleInstance, config); if (r != MI_RESULT_OK) { LOGMSG(("Lifecycle_ModifyInstance for class (%s) failed with result (%d)", config->className, r)); } } if (config->lifecycleThreadControl & MI_LIFECYCLE_INDICATION_DELETE) { r = lifecycle_DeleteInstance(config); if (r != MI_RESULT_OK) { LOGMSG(("Lifecycle_DeleteInstance for class (%s) failed with result (%d)", config->className, r)); } } if (config->lifecycleThreadControl & MI_LIFECYCLE_INDICATION_READ) { r = lifecycle_EnumerateInstances(config); if (r != MI_RESULT_OK) { LOGMSG(("Lifecycle_EnumerateInstances for class (%s) failed with result (%d)", config->className, r)); } } if (config->lifecycleThreadControl & MI_LIFECYCLE_INDICATION_METHODCALL) { r = lifecycle_InvokeMethod(config); if (r != MI_RESULT_OK) { LOGMSG(("Lifecycle_InvokeMethod for class (%s) failed with result (%d)", config->className, r)); } } } } LOGMSG(("Fired #%d indication for class (%s)", config->count, config->className)); } Atomic_Swap( &config->threadrunning, 0); LOGMSG(("Set threadrunning to 0 for config (%p)", config)); if (MI_FALSE == config->disabled) { LOGMSG(("fireindication stopped due to class (%s) need to fail after firing (%d) indicaitons", config->className, failAfterCount)); #if !defined(_MSC_VER) // if not joined yet, release thread resources pthread_detach(config->thread.__impl); # endif if (failResult != MI_RESULT_OK) { if (config->lifecycleThreadControl == 0) { MI_Context_PostResult(config->postctx, failResult); } else { MI_LifecycleIndicationContext_PostResult(config->lifecycleContext, failResult); } LOGMSG(("Stop the fireindication and failed the operation with error (%s:%d)", config->className, failResult)); } } else LOGMSG(("fireindication stopped due to disable indication called")); LOGMSG(("Done fireindication for class (%s)", config->className)); return 0; }
void MI_CALL Load(MI_Module_Self** self, struct _MI_Context* context) { *self = NULL; MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL Unload(MI_Module_Self* self, struct _MI_Context* context) { MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL MSFT_DSCLocalConfigManager_Invoke_SendMetaConfiguration( _In_opt_ MSFT_DSCLocalConfigManager_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_DSCLocalConfigManager* instanceName, _In_opt_ const MSFT_DSCLocalConfigManager_SendMetaConfiguration* in) { MI_Result miResult; MI_Instance *cimErrorDetails = NULL; HANDLE m_clientThreadToken; MI_UNREFERENCED_PARAMETER(self); MI_UNREFERENCED_PARAMETER(nameSpace); MI_UNREFERENCED_PARAMETER(className); MI_UNREFERENCED_PARAMETER(methodName); MI_UNREFERENCED_PARAMETER(instanceName); MI_UNREFERENCED_PARAMETER(in); if(!in->MetaConfiguration.exists) { MI_Context_PostResult(context, MI_RESULT_INVALID_PARAMETER); return; } if(!OpenThreadToken(GetCurrentThread(), TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_DUPLICATE, TRUE, &m_clientThreadToken)) { GetCimWin32Error(GetLastError(), &cimErrorDetails, ID_LCMHELPER_THREADIMPERSONATION_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); return; } if (!SetThreadToken(NULL, NULL)) { GetCimWin32Error(GetLastError(), &cimErrorDetails, ID_LCMHELPER_REVERTSELF_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); CloseHandle(m_clientThreadToken); return; } miResult = SetMetaConfig(in->MetaConfiguration.value, &cimErrorDetails); if (!SetThreadToken(NULL, m_clientThreadToken)) { GetCimWin32Error(GetLastError(), &cimErrorDetails, ID_LCMHELPER_RESUMEIMPERSONATION_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); CloseHandle(m_clientThreadToken); return; } CloseHandle(m_clientThreadToken); if(miResult != MI_RESULT_OK) { MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); return; } MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL CIM_LANEndAssociationVlanEnd_Unload( CIM_LANEndAssociationVlanEnd_Self* self, MI_Context* context) { MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL MSFT_nxServiceResource_Invoke_GetTargetResource( _In_opt_ MSFT_nxServiceResource_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_nxServiceResource* instanceName, _In_opt_ const MSFT_nxServiceResource_GetTargetResource* in) { std::cerr << "Get" << std::endl; MI_Result r = MI_RESULT_OK; MI_Boolean res = MI_TRUE; MSFT_nxServiceResource_GetTargetResource out; MI_Instance *newInstance; MI_Value value; r = MSFT_nxServiceResource_GetTargetResource_Construct(&out, context); r = MSFT_nxServiceResource_GetTargetResource_Set_MIReturn(&out, 0); const MSFT_nxServiceResource * service = in->InputResource.value; r = MI_Instance_Clone(&service->__instance, &newInstance); std::vector<std::string> ret_strings; long exit_code = callPythonFunction( ret_strings, self->pGetFn, 4, PassString(service->Name), PassString(service->Controller), PassBoolean(service->Enabled), PassString(service->State)); // Expecting 4+1 parameters in return if (ret_strings.size() == (4+1) && exit_code == 0) { res = MI_TRUE; } else { MI_Context_PostResult(context, MI_RESULT_FAILED); return; } if (SetElement(newInstance, "Name", ret_strings[0], MI_STRING) != 0 || SetElement(newInstance, "Controller", ret_strings[1], MI_STRING) != 0 || SetElement(newInstance, "Enabled", ret_strings[2], MI_BOOLEAN) != 0 || SetElement(newInstance, "State", ret_strings[3], MI_STRING) != 0 || SetElement(newInstance, "Path", ret_strings[4], MI_STRING)) { MI_Context_PostResult(context, MI_RESULT_FAILED); return; } value.instance = newInstance; r = MI_Instance_SetElement(&out.__instance, "OutputResource", &value, MI_INSTANCE, 0); if ( r != MI_RESULT_OK ) { MI_Context_PostResult(context, r); return; } MI_Instance_Delete(newInstance); r = MSFT_nxServiceResource_GetTargetResource_Post(&out, context); if ( r != MI_RESULT_OK ) { MI_Context_PostResult(context, r); return; } r = MSFT_nxServiceResource_GetTargetResource_Destruct(&out); if ( r != MI_RESULT_OK ) { MI_Context_PostResult(context, r); return; } MI_Context_PostResult(context, MI_RESULT_OK); }
void MI_CALL MSFT_DSCLocalConfigManager_Invoke_ApplyConfiguration( _In_opt_ MSFT_DSCLocalConfigManager_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_DSCLocalConfigManager* instanceName, _In_opt_ const MSFT_DSCLocalConfigManager_ApplyConfiguration* in) { MI_Result miResult; MI_Instance *cimErrorDetails = NULL; MSFT_DSCLocalConfigManager_ApplyConfiguration outputObject; HANDLE m_clientThreadToken; MI_UNREFERENCED_PARAMETER(self); MI_UNREFERENCED_PARAMETER(nameSpace); MI_UNREFERENCED_PARAMETER(className); MI_UNREFERENCED_PARAMETER(methodName); MI_UNREFERENCED_PARAMETER(instanceName); MI_UNREFERENCED_PARAMETER(in); if(!OpenThreadToken(GetCurrentThread(), TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_DUPLICATE, TRUE, &m_clientThreadToken)) { GetCimWin32Error(GetLastError(), &cimErrorDetails, ID_LCMHELPER_THREADIMPERSONATION_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); return; } if (!SetThreadToken(NULL, NULL)) { GetCimWin32Error(GetLastError(), &cimErrorDetails, ID_LCMHELPER_REVERTSELF_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); CloseHandle(m_clientThreadToken); return; } miResult = MSFT_DSCLocalConfigManager_ApplyConfiguration_Construct(&outputObject, context); if(miResult != MI_RESULT_OK) { GetCimMIError(miResult, &cimErrorDetails, ID_LCMHELPER_CONSTRUCTAPPLY_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); SetThreadToken(NULL, m_clientThreadToken); CloseHandle(m_clientThreadToken); return; } miResult = CallConsistencyEngine(context, &cimErrorDetails); if(miResult != MI_RESULT_OK) { MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); SetThreadToken(NULL, m_clientThreadToken); CloseHandle(m_clientThreadToken); return; } miResult = MSFT_DSCLocalConfigManager_ApplyConfiguration_Set_MIReturn(&outputObject, 0); if(miResult != MI_RESULT_OK) { GetCimMIError(miResult, &cimErrorDetails, ID_LCMHELPER_SETAPPLY_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); SetThreadToken(NULL, m_clientThreadToken); CloseHandle(m_clientThreadToken); return; } miResult = MSFT_DSCLocalConfigManager_ApplyConfiguration_Post(&outputObject, context); MSFT_DSCLocalConfigManager_ApplyConfiguration_Destruct(&outputObject); if (!SetThreadToken(NULL, m_clientThreadToken)) { GetCimWin32Error(GetLastError(), &cimErrorDetails, ID_LCMHELPER_RESUMEIMPERSONATION_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); CloseHandle(m_clientThreadToken); return; } CloseHandle(m_clientThreadToken); if(miResult != MI_RESULT_OK) { GetCimMIError(miResult, &cimErrorDetails, ID_LCMHELPER_POSTAPPLY_FAILED); MI_PostCimError(context, cimErrorDetails); MI_Instance_Delete(cimErrorDetails); return; } MI_Context_PostResult(context, MI_RESULT_OK); }