11<?xml version =" 1.0" encoding =" UTF-8" ?>
2- <Export generator =" Cache" version =" 25" zv =" Cache for Windows (x86-64) 2014.1.1 (Build 702U)" ts =" 2014-09-03 16:10:57 " >
2+ <Export generator =" Cache" version =" 25" zv =" Cache for Windows (x86-64) 2014.1.1 (Build 702U)" ts =" 2014-09-08 17:44:46 " >
33<CSP name =" CNARegistryExample.CSP" application =" /csp/dev/" default =" 1" ><![CDATA[
44<html>
55<head>
6-
76<title> CNA Registry Example </title>
8-
97</head>
10-
118<body>
129<form action="CNARegistryExample.csp" method="GET">
1310Subkey of HKEY_CURRENT_USER:<br>
14- <input type="text" name="subkey" value="#($GET(%request.Data("param ", 1)))#"><br>
11+ <input type="text" name="subkey" value="#($GET(%request.Data("subkey ", 1)))#"><br>
1512Parameter:<br>
16- <input type="text" name="param" value="#($GET(%request.Data("subkey ", 1)))#"><br>
13+ <input type="text" name="param" value="#($GET(%request.Data("param ", 1)))#"><br>
1714Path to libcna.dll:<br>
1815<input type="text" name="path" value="#($GET(%request.Data("path", 1)))#"><br>
1916<button type="submit">Get key</button>
@@ -31,7 +28,7 @@ if ($Data(%request.Data("subkey", 1)) && $Data(%request.Data("param", 1))) {
3128 set libc = ##class(CNA.CNA).%New(CNAPath)
3229 do libc.LoadLibrary("C:\Windows\System32\msvcrt.dll")
3330
34- // Вызываем malloc, чтобы выделить память под буферы, кооторые используются в вызовах WinAPI
31+ // Вызываем malloc, чтобы выделить память под буферы, которые используются в вызовах WinAPI
3532 set argTypes = $lb(libc.#SIZET)
3633 set phkey = libc.CallFunction("malloc", libc.#POINTER, argTypes, 4)
3734 set size = 1000
@@ -54,7 +51,7 @@ if ($Data(%request.Data("subkey", 1)) && $Data(%request.Data("param", 1))) {
5451 set argTypes = $lb(advapi.#LONG, advapi.#POINTER)
5552 set res = advapi.CallFunction("RegOpenCurrentUser", advapi.#INT, argTypes, $zhex("20019"), phkey)
5653 if (res '= 0) {
57- w " RegOpenCurrentUset error: " _ res _ "<br >"
54+ write "<b><font color='red'> RegOpenCurrentUset error: " _ res _ "</font></b >"
5855 return
5956 }
6057
@@ -76,9 +73,9 @@ if ($Data(%request.Data("subkey", 1)) && $Data(%request.Data("param", 1))) {
7673 set res = advapi.CallFunction("RegGetValueA", advapi.#LONG, argTypes, hkey, pSubkey, pParam, $zhex("ffff"), advapi.NULL, valueBuf, sizeBuf)
7774
7875 if (res = 0) {
79- w advapi.ConvertPointerToString(valueBuf), "<br>"
76+ write advapi.ConvertPointerToString(valueBuf), "<br>"
8077 } else {
81- w "<b><font color='red'>RegGetValue Error: " _ res _ "</font></b>"
78+ write "<b><font color='red'>RegGetValue Error: " _ res _ "</font></b>"
8279 }
8380
8481
@@ -90,9 +87,9 @@ if ($Data(%request.Data("subkey", 1)) && $Data(%request.Data("param", 1))) {
9087 do libc.CallFunction("free", libc.#VOID, argTypes, sizeBuf)
9188 do libc.FreeLibrary()
9289 } catch ex {
93- w "<b><font color='red'>"
90+ write "<b><font color='red'>"
9491 w $system.Status.GetErrorText(ex.AsStatus())
95- w "</font></b>"
92+ write "</font></b>"
9693 }
9794}
9895</script>
0 commit comments