Skip to content

Commit

Permalink
Fixes for Nim 2
Browse files Browse the repository at this point in the history
  • Loading branch information
miere43 committed Aug 30, 2023
1 parent 8408be3 commit d5d157b
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 199 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Deal with Windows Registry from Nim.

Online docs here: http://miere.ru/docs/registry/

```nim
import winregistry
Expand All @@ -28,11 +26,15 @@ finally:
Run in command line:
```
$ nimble test
$ nimble testansi
```
You should see a "tests passed" message. If you get `Access is denied` error, try running with administrator rights.

## Changelog
### 2.0.0
- Added support for Nim 2.0.0
- Removed support for `useWinUnicode` switch
- `WinString` type was removed; use `WideCString` instead

### 1.0.0
- `RegValueKind` and `RegKeyRights` are distinct `uint32`'s now (fixed warning about enums with holes).
- Replaced `RegistryError` with `OSError` for consistency with built-in `registry` package.
Expand Down
2 changes: 0 additions & 2 deletions doc/modulespec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Notes
-----

* When writing UTF-16 chars in ``useWinAnsi`` mode using `writeMultiString<#writeMultiString>`_ you will see garbage if you view that string in registry, but `readMultiString<#readMultiString>`_ will decode it correctly.
* Registry paths use backslashes ``(\)``, forwardslashes ``(/)`` are parsed as normal characters.
* Module procs' do not convert values from UTF-16 to UTF-8, howerer, when ``useWinAnsi`` defined, Windows handles conversion from UTF-16 strings to ASCII.
* If some procs throw ``OSError``, but everything seems okay, make sure registry handle have proper security rights.
* Registry on MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724871(v=vs.85).aspx
* Note that registry entries may be stored separately for 32/64-bit applications: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724072(v=vs.85).aspx
Expand Down
6 changes: 2 additions & 4 deletions tests/tester.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import sequtils, winregistry, winlean

echo "unicode: " & $useWinUnicode
import sequtils, winregistry

var passed = true
var msg, stacktrace: string
Expand Down Expand Up @@ -80,7 +78,7 @@ try:
handle = 0.RegHandle

# delSubkey(HKEY_LOCAL_MACHINE, "Software\\AAAnim_reg_test", samWow32)
except OSError, AssertionDefect:
except:
passed = false
msg = getCurrentExceptionMsg()
stacktrace = getStackTrace(getCurrentException())
Expand Down
Loading

0 comments on commit d5d157b

Please sign in to comment.