Code: byte[] descBuffer = new byte[4]; SLDATATYPE slDataType = SLDATATYPE.SL_DATA_DWORD; NativeMethods.SPPGetApplicationInformation(sppHandle, ref windowsAppID, "RemainingRearmCount", ref slDataType, ref descSize, ref descBuffer); // Close Handle to Microsoft Windows Software Licensing Service NativeMethods.SPPClose(sppHandle); NativeMethods.FreeLibrary(sppDllHandle); // Return Rearm Count return descBuffer[0]; You return the least significant byte from descBuffer. descSize && descBuffer are both output. SLGetApplicationInformation allocates descBuffer and sets descSize.
Yes like in my c++ source: Code: UINT descSize; PBYTE descBuffer; if(_SLGetApplicationInformation(hslcOSPP, (SLID*)Office2013GUID, L"RemainingRearmCount", NULL, &descSize, &descBuffer) != S_OK) wprintf_s(L"osppc.SLGetApplicationInformation\n\n"); else{ StringCbPrintf(msg, MAX_MSG_SIZE, L"RemainingRearmCount (Office 2013): %d\n\n", *(DWORD*)descBuffer); wprintf_s(msg); LocalFree(descBuffer); }