delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/09/30/09:06:13

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <19990930130607.2403.rocketmail@web108.yahoomail.com>
Date: Thu, 30 Sep 1999 06:06:07 -0700 (PDT)
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: earnie_boyd AT yahoo DOT com
Subject: Re: Accessing the registry
To: Peter Mount <petermount AT it DOT maidstone DOT gov DOT uk>,
"Cygwin List \(E-mail\)" <cygwin AT sourceware DOT cygnus DOT com>
MIME-Version: 1.0

Look at the source code for the cygwin mount program for an example.

--- Peter Mount <petermount AT it DOT maidstone DOT gov DOT uk> wrote:
> 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
> 
> 


=====
Earnie Boyd <mailto:earnie_boyd AT yahoo DOT com>

Newbies, please visit
<http://www.freeyellow.com/members5/gw32/index.html>

(If you respond to the list, then please don't cc me)
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019