--- a/Win32OperatingSystem.st Tue Feb 21 22:56:59 2006 +0100
+++ b/Win32OperatingSystem.st Tue Feb 21 22:57:13 2006 +0100
@@ -8796,6 +8796,25 @@
!Win32OperatingSystem::RegistryEntry class methodsFor:'instance creation'!
+immediateHandle:aHandleValue
+ |h newEntry|
+
+ aHandleValue isInteger ifTrue:[
+ h := ExternalAddress newAddress:aHandleValue
+ ] ifFalse:[
+ h := aHandleValue
+ ].
+
+ "/ rootKeys are not registered for RegClose ...
+ newEntry := self basicNew setHandle:h path:nil.
+ newEntry registerForFinalization.
+ ^ newEntry.
+
+ "
+ RegistryEntry immediateHandle:16r80000002
+ "
+!
+
key:aKeyNamePath
"retrieve an entry by full path name (starting at a root)"
@@ -8950,6 +8969,10 @@
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing'!
+handleValue
+ ^ handle address
+!
+
name
"return the keys name component (subKey name within my
parent key)"
@@ -8981,18 +9004,18 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(subKeyString) || __isSymbol(subKeyString))) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if (RegCreateKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
- subHandle = __MKEXTERNALADDRESS(subKey);
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if (RegCreateKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
+ subHandle = __MKEXTERNALADDRESS(subKey);
+ }
}
%}.
subHandle notNil ifTrue:[
- newEntry := self class basicNew
- setHandle:subHandle
- path:(path , self class separator asString , subKeyString).
- Lobby register:newEntry.
- ^ newEntry.
+ newEntry := self class basicNew
+ setHandle:subHandle
+ path:(path , self class separator asString , subKeyString).
+ newEntry registerForFinalization.
+ ^ newEntry.
].
^ nil
@@ -9040,16 +9063,16 @@
HKEY myKey, remoteKey = 0;
if (__isExternalAddressLike(__INST(handle)) && __isString(hostName)) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if (RegConnectRegistry(__stringVal(hostName), myKey, &remoteKey) == ERROR_SUCCESS) {
- remoteHandle = __MKEXTERNALADDRESS(remoteKey);
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if (RegConnectRegistry(__stringVal(hostName), myKey, &remoteKey) == ERROR_SUCCESS) {
+ remoteHandle = __MKEXTERNALADDRESS(remoteKey);
+ }
}
%}.
remoteHandle notNil ifTrue:[
- newEntry := self class basicNew setHandle:remoteHandle path:path.
- Lobby register:newEntry.
- ^ newEntry.
+ newEntry := self class basicNew setHandle:remoteHandle path:path.
+ newEntry registerForFinalization.
+ ^ newEntry.
].
^ nil
@@ -9077,7 +9100,6 @@
top := self key:'HKEY_USERS'.
remote := top remoteKeyOnHost:'JOSHUA'
"
-
!
subKeyAtIndex:subKeyIndex
@@ -9132,18 +9154,19 @@
if (__isExternalAddressLike(__INST(handle))
&& (__isString(subKeyString) || __isSymbol(subKeyString))) {
- myKey = (HKEY)__externalAddressVal(__INST(handle));
- if (RegOpenKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
- subHandle = __MKEXTERNALADDRESS(subKey);
- }
+ myKey = (HKEY)__externalAddressVal(__INST(handle));
+ if (RegOpenKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
+ subHandle = __MKEXTERNALADDRESS(subKey);
+ }
}
%}.
subHandle notNil ifTrue:[
- newEntry := self class basicNew
- setHandle:subHandle
- path:(path , self class separator asString , subKeyString).
- Lobby register:newEntry.
- ^ newEntry.
+ newEntry := self class basicNew
+ setHandle:subHandle
+ path:(path , self class separator asString , subKeyString).
+
+ newEntry registerForFinalization.
+ ^ newEntry.
].
^ nil
@@ -9592,9 +9615,7 @@
"close mySelf"
self closeKey.
- Lobby unregister:self.
-
- "Modified: / 19.5.1999 / 22:44:44 / cg"
+ self unregisterForFinalization.
!
closeKey
@@ -9611,6 +9632,10 @@
%}
!
+finalizationLobby
+ ^ Lobby
+!
+
finalize
"some entry has been collected - close it"
@@ -11067,7 +11092,7 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.218 2006-02-21 18:04:17 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.219 2006-02-21 21:57:13 cg Exp $'
! !
Win32OperatingSystem initialize!