Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <1B3D5E532D18D311861A00600865478C25E679@exchange1.nt.maidstone.gov.uk> From: Peter Mount To: "Cygwin List (E-mail)" Subject: Accessing the registry Date: Thu, 30 Sep 1999 10:18:52 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.1960.3) Content-Type: text/plain Does anyone have any examples on accessing the Windows 95/NT registry from Cygwin? Being a unix programmer, I try to stay away from windows as much as possible, but I have one project where we have to update the registry. I'm currently using the following function, but I'm not certain if this correct, or if there is an easier way. Thanks in advance, Peter -- Peter Mount Enterprise Support Maidstone Borough Council Any views stated are my own, and not those of Maidstone Borough Council. LONG setRegistryValue(HKEY keyroot,char *key,char *value,char *buf) { DWORD bufsz = strlen(buf)+1; DWORD regtyp; LONG reg; HKEY keyid; DWORD disp; reg = RegCreateKeyEx( keyroot, key, 0, // must be null "mbchelp", // I have no idea REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, (PHKEY)&keyid, (LPDWORD)&disp ); if(reg != ERROR_SUCCESS) printErrorMessage(reg); reg = RegSetValueEx( keyid, value, 0, // must be null REG_SZ, (LPBYTE)buf, bufsz ); if(reg != ERROR_SUCCESS) printErrorMessage(reg); reg = RegCloseKey(keyid); if(reg != ERROR_SUCCESS) printErrorMessage(reg); return regtyp; } -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com