if (FAILED(methodExec(wmi,*session, L"SetValue", inMethodInst, &outMethodInst)))
goto methodexecfailed;
- if (outMethodInst==NULL)
- goto sessionExec;
+ if (outMethodInst!=NULL)
+ outMethodInst->Release();
- outMethodInst->Release();
+ inMethodInst->Release();
+ SysFreeString(vvalue.bstrVal);
+ SysFreeString(vpath.bstrVal);
- err=0;
+ return 0;
methodexecfailed:
-sessionExec:
+ XsLog("WmiSessionSetEntry:MethodExec Failed");
inMethodInst->Release();
sessionstart:
+ XsLog("WmiSessionSetEntry:SessionStart Failed");
SysFreeString(vvalue.bstrVal);
setvvalue:
+ XsLog("WmiSessionSetEntry:SetVValue Failed");
SysFreeString(vpath.bstrVal);
setvpath:
+ XsLog("WmiSessionSetEntry:SetVPath Failed ");
return err;
}
static __declspec(thread) LONG localthreadcount = 0;
static __declspec(thread) LONG localwmicount = 0;
-static long update_cnt;
+static long update_cnt=0xF0000000;
#define XENSTORE_MAGIC 0x7e6ec123
void *XsAlloc(size_t size) {
BOOL XenstoreKickXapi()
{
- /* Old protocol */
- if (WmiSessionSetEntry(&wmi, &WmiSessionHandle, "data/updated", "1"))
- return false;
/* New protocol */
- if (XenstorePrintf("data/update_cnt", "%I64d", update_cnt))
+ if (XenstorePrintf("data/update_cnt", "%I64d", update_cnt)){
+ XsLog("New kick failed ");
return false;
-
+ }
+ /* Old protocol */
+ if (WmiSessionSetEntry(&wmi, &WmiSessionHandle, "data/updated", "1")){
+ XsLog("Old kick failed");
+ return false;
+ }
update_cnt++;
return true;
}
size_t len;
*value =WmiSessionGetEntry(&wmi, &WmiSessionHandle, path, &len);
if (*value)
- return len;
+ return (ssize_t)len;
else
return -1;
}
}
+ XsLogMsg("About to add feature shutdown");
if (!AddFeature(&features, "control/shutdown", "control/feature-shutdown",
"shutdown", maybeReboot, NULL, wmierrorEvent)) {
return exit;
}
-
+ XsLogMsg("About to advertise features");
AdvertiseFeatures(&features);
+ XsLogMsg("About to kick xapi ");
XenstoreKickXapi();
while (1)
return;
}
BOOL stopping;
- //InitCom();
do {
}
} while (!stopping);
- //ReleaseCom();
XsLog("Guest agent service stopped");
ShutdownXSAccessor();
ServiceControlManagerUpdate(0, SERVICE_STOPPED);