GetDeviceDataDump function
int __stdcall GetDeviceDataDump( LPCWSTR psFileName );
psFileName
The file name where to save the device data into.
If the function succeeds, the return value is zero and the psFileName contain the dumped diagnostic data.
If the function fails, the return value is negative number. See the Example for more details about possible error codes.
-2
.#include <windows.h> #include <stdio.h> typedef int(__stdcall *GETDEVICEDATADUMP)(LPCWSTR psFileName); //--------------------------------------------------------------------------- // API error codes //--------------------------------------------------------------------------- #define MTPDRIVEAPI_ERROR_SUCCESS 0 #define MTPDRIVEAPI_ERROR_FAILURE -1 #define MTPDRIVEAPI_ERROR_NOLICENSE -2 #define MTPDRIVEAPI_ERROR_INVALIDARG -3 #define MTPDRIVEAPI_ERROR_INVALIDDRV -4 #define MTPDRIVEAPI_ERROR_CANNOTCREATEFILE -5 int main(int argc, char* argv[]) { HMODULE hDll; int nResult = 0; LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc); if (!argvW || argc != 2) { printf("Usage: APItestGetDeviceDataDump.exe outputFileName\n"); LocalFree(argvW); return 1; } SetDllDirectory("c:\\Program Files\\MTPdrive"); hDll = LoadLibrary("MTPdrive.dll"); if (hDll) { GETDEVICEDATADUMP pGetDeviceDataDump = (GETDEVICEDATADUMP)GetProcAddress(hDll, "GetDeviceDataDump"); if (pGetDeviceDataDump) { nResult = pGetDeviceDataDump(argvW[1]); printf("Result: %d\n", nResult); } else { printf("Cannot load function GetDeviceDataDump\n"); nResult = 2; } FreeLibrary(hDll); } else { printf("Cannot load library MTPdrive.dll\n"); nResult = 3; } LocalFree(argvW); return nResult; }