HRESULT MqiRollbackDeleteMessageQueues( LPWSTR* ppwzData ) { HRESULT hr = S_OK; int iCnt = 0; MQI_MESSAGE_QUEUE_ATTRIBUTES attrs; ::ZeroMemory(&attrs, sizeof(attrs)); // ger count hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); for (int i = 0; i < iCnt; i++) { // read attributes from CustomActionData hr = ReadMessageQueueAttributes(ppwzData, &attrs); ExitOnFailure(hr, "Failed to read attributes"); // create message queue hr = CreateMessageQueue(&attrs); if (FAILED(hr)) WcaLog(LOGMSG_STANDARD, "Failed to create message queue, hr: 0x%x, key: %S", hr, attrs.pwzKey); } hr = S_OK; LExit: // clean up FreeMessageQueueAttributes(&attrs); return hr; }
HRESULT MqiCreateMessageQueues( LPWSTR* ppwzData ) { HRESULT hr = S_OK; int iCnt = 0; MQI_MESSAGE_QUEUE_ATTRIBUTES attrs; ::ZeroMemory(&attrs, sizeof(attrs)); // ger count hr = WcaReadIntegerFromCaData(ppwzData, &iCnt); ExitOnFailure(hr, "Failed to read count"); for (int i = 0; i < iCnt; i++) { // read attributes from CustomActionData hr = ReadMessageQueueAttributes(ppwzData, &attrs); ExitOnFailure(hr, "Failed to read attributes"); // progress message hr = PcaActionDataMessage(1, attrs.pwzPathName); ExitOnFailure1(hr, "Failed to send progress messages, key: %S", attrs.pwzKey); // create message queue hr = CreateMessageQueue(&attrs); ExitOnFailure1(hr, "Failed to create message queue, key: %S", attrs.pwzKey); // progress tics hr = WcaProgressMessage(COST_MESSAGE_QUEUE_CREATE, FALSE); ExitOnFailure(hr, "Failed to update progress"); } hr = S_OK; LExit: // clean up FreeMessageQueueAttributes(&attrs); return hr; }
// this is ran in the beginning of the OFW's task init process void hack_pre_init_hook(void) { action_queue = (int*)CreateMessageQueue("action_queue", 0x40); CreateTask("Action Dispatcher", 25, 0x2000, action_dispatcher, 0); }