Author: remi
Date: 2008-11-30 10:41:28 +0100 (Sun, 30 Nov 2008)
New Revision: 2928

Added:
   software_suite_v2/software/cc_IUUID_for_win/
   software_suite_v2/software/cc_IUUID_for_win/trunk/
   software_suite_v2/software/cc_IUUID_for_win/trunk/IUUID.dpr
Log:
* added IUUID registry writer for the control center on Windows.

Added: software_suite_v2/software/cc_IUUID_for_win/trunk/IUUID.dpr
===================================================================
--- software_suite_v2/software/cc_IUUID_for_win/trunk/IUUID.dpr                 
        (rev 0)
+++ software_suite_v2/software/cc_IUUID_for_win/trunk/IUUID.dpr 2008-11-30 
09:41:28 UTC (rev 2928)
@@ -0,0 +1,90 @@
+{*
+ * IUUID writer for Control center.
+ *
+ * Copyright (C) 2008 C2ME Sa <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *}
+
+program IUUID;
+
+{$APPTYPE CONSOLE}
+
+uses
+  Windows,
+  SysUtils,
+  dialogs,
+  Registry;
+
+const
+  TUXDROID_REGISTRY_PATH = 'SOFTWARE\Tuxdroid\TuxdroidSetup';
+
+function getHttpServerPath : string;
+begin
+  result := '';
+  with TRegistry.Create do
+    try
+      RootKey := HKEY_LOCAL_MACHINE;
+
+      // From Tuxdroid setup
+      if OpenKey(TUXDROID_REGISTRY_PATH, False) then
+      begin
+        // Get tuxdroid installation path
+        result := ReadString('Install_Dir');
+        CloseKey;
+      end;
+    finally
+      Free;
+    end;
+end;
+
+function getIUUIDFromDisk(tuxdroidPath : string) : string;
+var
+  f : TextFile;
+  line : string;
+begin
+  try
+    AssignFile(f, tuxdroidPath + '/resources/misc/IUUID.txt');
+    Reset(f);
+    ReadLn(f, line);
+    CloseFile(f);
+    result := line;
+  except
+    result := '0000-000-000-000';
+  end;
+end;
+
+procedure rewriteIUUIDInRegistry(newIUUID : string);
+begin
+  with TRegistry.Create do
+    try
+      RootKey := HKEY_LOCAL_MACHINE;
+
+      // From Tuxdroid setup
+      if OpenKey(TUXDROID_REGISTRY_PATH, False) then
+      begin
+        // Get tuxdroid installation path
+        WriteString('IUUID', newIUUID);
+        CloseKey;
+      end;
+    finally
+      Free;
+    end;
+end;
+
+begin
+  rewriteIUUIDInRegistry(getIUUIDFromDisk(getHttpServerPath));
+end.


Property changes on: software_suite_v2/software/cc_IUUID_for_win/trunk/IUUID.dpr
___________________________________________________________________
Name: svn:keywords
   + Id


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to