Hi Does anyone have an app which will pull the current OEM Version and write io to a text file. I know we have a Systems Properties API which can access this info, but I am hoping someone may already have a small app coded which can do this. I have a large customer who needs to access the OEM Version number of the device (MC75A6) via Afaria (Remote managment software) to make a decision on wether a device has been updated or not. If I can save the OEM number in a machine readable format we can get Afaria to read the output file to get the OEM number. Any help would be most appreciated.
App to write OEM Version number to a file.// Expert user has replied. |
6 Replies
In the meantime I wrote it in C, which is easier for an old man like me:
typedef DWORD (WINAPI* CAD_FUNC) (int *,int *);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpszCmdLine, int nCmdShow) { DWORD CadLibrary; CAD_FUNC lpfn_GetOEM; int major, minor; FILE *fd;
CadLibrary = (DWORD)LoadLibrary(L"CAD.DLL");
if (!CadLibrary) { MessageBox(NULL, L"DLL", L"ERROR", MB_OK); return 1; }
lpfn_GetOEM = (CAD_FUNC)GetProcAddress((HMODULE)CadLibrary, _T("CAD_GetOemVersionNumber")); if( !lpfn_GetOEM) { FreeLibrary((HMODULE)CadLibrary); MessageBox(NULL, L"Method", L"ERROR", MB_OK); return 1; }
lpfn_GetOEM(&major, &minor);
fd = _wfopen(L"/Temp/OEMVersion.txt", L"w"); fwprintf(fd, L"%02d.%02d", major, minor); fclose(fd);
return 0; }
This leaves a file called OEMVersion.txt in \Temp. It contains something like MM.mm, the .0001 is not detected. Please find attached the exacutable. I hope this helps!
The problem with cut and paste is you need to select the right bits!
A C version is also fine :-) /// /// P/Invoke for the OEM Version Number /// /// /// /// [DllImport("CAD.dll")] public static extern int CAD_GetOemVersionNumber(out IntPtr iVerMaj, out IntPtr iVerMin); /// /// P/Invoke for the OEM Build Number /// /// /// [DllImport("CAD.dll")] public static extern int CAD_GetOemBuildNumber(out IntPtr iBuild); ///
/// Get the OEM data /// /// private static string GetOEMInfo() { IntPtr iVerMaj = IntPtr.Zero; IntPtr iVerMin = IntPtr.Zero; IntPtr iBuild = IntPtr.Zero; NativeMethods.CAD_GetOemVersionNumber(out iVerMaj, out iVerMin); NativeMethods.CAD_GetOemBuildNumber(out iBuild); return iVerMaj.ToString() + "." + iVerMin.ToString() + "." + iBuild.ToString(); }
Hello Andrea, The SysInfo sample included in EMDK for C developer tool demonstrates the way of retrieving OEM info (Major. Minor. Build numbers) from a motorola device. PFA: The SysInfoSample from EMDK for C v2.5 Regards, Mahesh
Source code required (C#) below
/// /// P/Invoke for the OEM Version Number /// /// /// /// [DllImport("CAD.dll")] public static extern int CAD_GetOemVersionNumber(out IntPtr iVerMaj, out IntPtr iVerMin);
/// /// Get the OEM string data /// /// private static string GetTerminalInfo() { string szOEMInfo = " "; string strOEMInfo = ""; // Get OEM Info if (NativeMethods.SystemParametersInfo(NativeMethods.SPI_GETOEMINFO, szOEMInfo.Length, szOEMInfo, 0) != 0) strOEMInfo = szOEMInfo.Substring(0, szOEMInfo.IndexOf('\0')); return strOEMInfo; } ... txtTerminal.Text = GetTerminalInfo();
...
I guess that NativeMethods.SystemParametersInfo(NativeMethods.SPI_GETOEMINFO, szOEMInfo.Length, szOEMInfo, 0) will put in szOEMInfo something like "MOTOROLA MC75A" or so, instead of the required OEM version number. In C++, that's what is returned. Maybe C# is different :)
WCHAR wcManufacturer[256]={0};
if( SystemParametersInfo(SPI_GETOEMINFO, 255, wcManufacturer, 0) == FALSE) return FALSE; However, this method exposed in CAD.dll seems to be the answer. How should it be used?
Hi, Install this cab will run my app that save all the info to the registry and saves to" \Application\\DeviceInfo.Reg" [HKEY_LOCAL_MACHINE\Software\Motorola\DeviceInfo] "Serial Number"="S8319521100146" "IPL"="01.53" "BSP"="02.35.05" "Power Micro"="63.37.03" "UUID"="{0D439101-0D487F7A-00000000-00000000}" "Operating System"="5.00 Build 1400"