summaryrefslogtreecommitdiffstats
path: root/utils/MTP/beastpatcher/mtp_win32.c
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-10-30 11:01:00 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-10-30 11:01:00 +0000
commit1e74ef639d9d6701d732ee61164f84cf2f660a09 (patch)
tree89e08c92cba561763e333df103ce7d44ebae2099 /utils/MTP/beastpatcher/mtp_win32.c
parent6f716e905590fa7c1b759250bcbbcd2f7104a4f6 (diff)
downloadrockbox-1e74ef639d9d6701d732ee61164f84cf2f660a09.tar.gz
rockbox-1e74ef639d9d6701d732ee61164f84cf2f660a09.tar.bz2
rockbox-1e74ef639d9d6701d732ee61164f84cf2f660a09.zip
beastpatcher: check WMP version.
The current implementation fails silently if Windows Media Player is version 10. Add a check and inform the user if the version installed is too old to work properly with beastpatcher. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30864 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/MTP/beastpatcher/mtp_win32.c')
-rw-r--r--utils/MTP/beastpatcher/mtp_win32.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/utils/MTP/beastpatcher/mtp_win32.c b/utils/MTP/beastpatcher/mtp_win32.c
index 15d0d705e2..626467ecbe 100644
--- a/utils/MTP/beastpatcher/mtp_win32.c
+++ b/utils/MTP/beastpatcher/mtp_win32.c
@@ -230,3 +230,45 @@ static int filesize(const char* filename)
return sb.st_size;
}
+/* Retrieve version of WMP as described in
+ * http://msdn.microsoft.com/en-us/library/dd562731%28VS.85%29.aspx
+ * Since we're after MTP support checking for the WMP6 key is not necessary.
+ */
+int mtp_wmp_version(void)
+{
+ DWORD ret;
+ HKEY hk;
+ DWORD type;
+ DWORD enable = -1;
+ DWORD enablelen = sizeof(DWORD);
+ char buf[32];
+ DWORD buflen = sizeof(buf);
+ int version = 0;
+
+ ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{6BF52A52-394A-11d3-B153-00C04F79FAA6}",
+ 0, KEY_QUERY_VALUE, &hk);
+
+ if(ret != ERROR_SUCCESS) {
+ return 0;
+ }
+ type = REG_DWORD;
+ ret = RegQueryValueExA(hk, "IsInstalled", NULL, &type, (LPBYTE)&enable, &enablelen);
+ if(ret != ERROR_SUCCESS) {
+ RegCloseKey(hk);
+ return 0;
+ }
+ if(enable) {
+ type = REG_SZ;
+ ret = RegQueryValueExA(hk, "Version", NULL, &type, (LPBYTE)buf, &buflen);
+ }
+ if(ret == ERROR_SUCCESS) {
+ /* get major version from registry value */
+ buf[31] = '\0';
+ version = atoi(buf);
+ }
+ RegCloseKey(hk);
+
+ return version;
+}
+