Click here to Skip to main content
15,886,578 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using cmd to get a value from the mysql db Pin
Ingo27-Sep-12 1:22
Ingo27-Sep-12 1:22 
QuestionDelete records in binary file? Pin
Member 245846726-Sep-12 22:01
Member 245846726-Sep-12 22:01 
AnswerRe: Delete records in binary file? Pin
Pete O'Hanlon26-Sep-12 22:04
mvePete O'Hanlon26-Sep-12 22:04 
AnswerRe: Delete records in binary file? Pin
Eddy Vluggen26-Sep-12 23:55
professionalEddy Vluggen26-Sep-12 23:55 
GeneralRe: Delete records in binary file? Pin
Member 245846727-Sep-12 16:10
Member 245846727-Sep-12 16:10 
AnswerRe: Delete records in binary file? Pin
jschell27-Sep-12 10:08
jschell27-Sep-12 10:08 
QuestionHow to get remote registry uninstallstring date or key modified time? Pin
turbosupramk326-Sep-12 6:20
turbosupramk326-Sep-12 6:20 
AnswerRe: How to get remote registry uninstallstring date or key modified time? Pin
turbosupramk326-Sep-12 8:05
turbosupramk326-Sep-12 8:05 
Here is the function I ended up writing for this in case this comes up in a search. Future readers ... any questions, just ask

C#
  [DllImport("Advapi32.dll", EntryPoint = "RegEnumKeyExW")]
        private static extern int RegEnumKeyEx(
            UIntPtr hKey,
            int dwIndex,
            [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpName,
            ref int lpcName,
            int lpReserved,
            int lpClass,
            int lpcClass,
            [MarshalAs(UnmanagedType.Struct)] out System.Runtime.InteropServices.ComTypes.FILETIME lpftLastWriteTime
        );

public static string reg64readerModifiedDate(string serverName, string hive, string keyPath, string stringValue)
        {
            uint hiveConst = HKEY_LOCAL_MACHINE;
            switch (hive)
            {
                case "hkcr":
                    hiveConst = HKEY_CLASSES_ROOT;
                    break;

                case "hkey_classes_root":
                    hiveConst = HKEY_CLASSES_ROOT;
                    break;

                case "HKCR":
                    hiveConst = HKEY_CLASSES_ROOT;
                    break;

                case "HKEY_CLASSES_ROOT":
                    hiveConst = HKEY_CLASSES_ROOT;
                    break;

                case "hkcu":
                    hiveConst = HKEY_CURRENT_USER;
                    break;

                case "hkey_current_user":
                    hiveConst = HKEY_CURRENT_USER;
                    break;

                case "HKCU":
                    hiveConst = HKEY_CURRENT_USER;
                    break;

                case "HKEY_CURRENT_USER":
                    hiveConst = HKEY_CURRENT_USER;
                    break;

                case "hklm":
                    hiveConst = HKEY_LOCAL_MACHINE;
                    break;

                case "hkey_local_machine":
                    hiveConst = HKEY_LOCAL_MACHINE;
                    break;

                case "HKLM":
                    hiveConst = HKEY_LOCAL_MACHINE;
                    break;

                case "HKEY_LOCAL_MACHINE":
                    hiveConst = HKEY_LOCAL_MACHINE;
                    break;

                case "hku":
                    hiveConst = HKEY_USERS;
                    break;

                case "hkey_users":
                    hiveConst = HKEY_USERS;
                    break;

                case "HKU":
                    hiveConst = HKEY_USERS;
                    break;

                case "HKEY_USERS":
                    hiveConst = HKEY_USERS;
                    break;

                case "hkcc":
                    hiveConst = HKEY_CURRENT_CONFIG;
                    break;

                case "hkey_current_config":
                    hiveConst = HKEY_CURRENT_CONFIG;
                    break;

                case "HKCC":
                    hiveConst = HKEY_CURRENT_CONFIG;
                    break;

                case "HKEY_CURRENT_CONFIG":
                    hiveConst = HKEY_CURRENT_CONFIG;
                    break;

                case "hkdd":
                    hiveConst = HKEY_DYN_DATA;
                    break;

                case "hkey_dyn_data":
                    hiveConst = HKEY_DYN_DATA;
                    break;

                case "HKDD":
                    hiveConst = HKEY_DYN_DATA;
                    break;

                case "HKEY_DYN_DATA":
                    hiveConst = HKEY_DYN_DATA;
                    break;

                case "hkpd":
                    hiveConst = HKEY_PERFORMANCE_DATA;
                    break;

                case "hkey_performance_data":
                    hiveConst = HKEY_PERFORMANCE_DATA;
                    break;

                case "HKPD":
                    hiveConst = HKEY_PERFORMANCE_DATA;
                    break;

                case "HKEY_PERFORMANCE_DATA":
                    hiveConst = HKEY_PERFORMANCE_DATA;
                    break;

                default:
                    MessageBox.Show("Default");
                    break;
            }

            UIntPtr key = new UIntPtr(hiveConst);
            IntPtr remKey;
            int ret = RegConnectRegistry(serverName, key, out remKey);
            UIntPtr remKeyUIntPtr = unchecked((UIntPtr)(long)(ulong)remKey);
            string result = GetRegKey64DWord(remKeyUIntPtr, keyPath, RegSAM.WOW64_64Key, stringValue);
            uint lpcbData = 1024;
            StringBuilder strBuffer = new StringBuilder(1024);
            int dIndex = 0;
            int lpcName = 1024;
            int lpClass = 1024;
            int lpcClass = 1024;
           
            System.Runtime.InteropServices.ComTypes.FILETIME lpftLastWriteTime = new System.Runtime.InteropServices.ComTypes.FILETIME();
            RegEnumKeyEx(remKeyUIntPtr, dIndex, strBuffer, ref lpcName, 0, 0, 0, out lpftLastWriteTime);
            long hFT2 = (((long)lpftLastWriteTime.dwHighDateTime) << 32) + lpftLastWriteTime.dwLowDateTime;
            DateTime dt = DateTime.FromFileTime(hFT2);
                 
            //MessageBox.Show(result);
            RegCloseKey(remKey);
            result = dt.ToString();
            return (result);
        }

GeneralRe: How to get remote registry uninstallstring date or key modified time? Pin
Eddy Vluggen26-Sep-12 23:56
professionalEddy Vluggen26-Sep-12 23:56 
GeneralRe: How to get remote registry uninstallstring date or key modified time? Pin
turbosupramk327-Sep-12 4:23
turbosupramk327-Sep-12 4:23 
Questiondaily, Weekly and monthely datagrid view Pin
waqas_ali7626-Sep-12 4:50
waqas_ali7626-Sep-12 4:50 
AnswerRe: daily, Weekly and monthely datagrid view Pin
Richard MacCutchan26-Sep-12 5:13
mveRichard MacCutchan26-Sep-12 5:13 
AnswerRe: daily, Weekly and monthely datagrid view Pin
Simon_Whale26-Sep-12 5:29
Simon_Whale26-Sep-12 5:29 
GeneralRe: daily, Weekly and monthely datagrid view Pin
waqas_ali7626-Sep-12 5:40
waqas_ali7626-Sep-12 5:40 
GeneralRe: daily, Weekly and monthely datagrid view Pin
Pete O'Hanlon26-Sep-12 5:45
mvePete O'Hanlon26-Sep-12 5:45 
QuestionPuzzle 8 Solving with bfs Pin
mohammadkaab26-Sep-12 4:03
mohammadkaab26-Sep-12 4:03 
AnswerRe: Puzzle 8 Solving with bfs Pin
Ingo26-Sep-12 4:10
Ingo26-Sep-12 4:10 
GeneralRe: Puzzle 8 Solving with bfs Pin
mohammadkaab26-Sep-12 4:41
mohammadkaab26-Sep-12 4:41 
AnswerRe: Puzzle 8 Solving with bfs Pin
Ingo26-Sep-12 5:00
Ingo26-Sep-12 5:00 
AnswerRe: Puzzle 8 Solving with bfs - question etiquette. Pin
Pete O'Hanlon26-Sep-12 5:15
mvePete O'Hanlon26-Sep-12 5:15 
QuestionMonitor database changes of 3rd party SQL DB Pin
Adam_Dev26-Sep-12 1:50
Adam_Dev26-Sep-12 1:50 
AnswerRe: Monitor database changes of 3rd party SQL DB Pin
Ingo26-Sep-12 2:30
Ingo26-Sep-12 2:30 
GeneralRe: Monitor database changes of 3rd party SQL DB Pin
Adam_Dev26-Sep-12 22:14
Adam_Dev26-Sep-12 22:14 
AnswerRe: Monitor database changes of 3rd party SQL DB Pin
Ingo26-Sep-12 22:23
Ingo26-Sep-12 22:23 
AnswerRe: Monitor database changes of 3rd party SQL DB Pin
Pete O'Hanlon26-Sep-12 2:36
mvePete O'Hanlon26-Sep-12 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.