SlimIO / Winservices

Windows Services - low-level C++/Node.js N-API binding
MIT License
0 stars 0 forks source link

Trigger Specific Data item parsing #2

Open fraxken opened 6 years ago

fraxken commented 6 years ago

A l'heure actuelle le parsing de la structure SERVICE_TRIGGER_SPECIFIC_DATA_ITEMS n'est sûrement pas complète.

https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_service_trigger_specific_data_item

La documentation indique la chose suivante:

If the dwDataType member is SERVICE_TRIGGER_DATA_TYPE_BINARY, the trigger-specific data is an array of bytes.

If the dwDataType member is SERVICE_TRIGGER_DATA_TYPE_STRING, the trigger-specific data is a null-terminated string or a multistring of null-terminated strings, ending with two null-terminating characters. For example: "5001\0UDP\0%programfiles%\MyApplication\MyServiceProcess.exe\0MyService\0\0".

Néanmoins les retours de la méthode ne semble pas correct (voir le code cpp)

specificDataItems.Set("dataType", pServiceTrigger.dwDataType);
if (pServiceTrigger.dwDataType == SERVICE_TRIGGER_DATA_TYPE_BINARY) {
    specificDataItems.Set("data", byteSeqToString(pServiceTrigger.pData, pServiceTrigger.cbData));
}
else if(pServiceTrigger.dwDataType == SERVICE_TRIGGER_DATA_TYPE_STRING) {
    specificDataItems.Set("data", byteSeqToString(pServiceTrigger.pData, pServiceTrigger.cbData));
}

Le parsing de la séquence de bytes (et ou du WCHAR Unicode ne semble pas bon).

A creuser...