本帖最后由 666 于 2021-5-6 15:47 编辑
- .版本 2
- .支持库 spec
- .局部变量 Environment
- .局部变量 name
- .局部变量 namelen
- .局部变量 Unicodelen
- .局部变量 Unicode
- .局部变量 punicode_string, 长整数型
- .局部变量 pUnicodelen
- .局部变量 outpunicode_string, 长整数型
- .局部变量 outUnicode
- ' Environment 计算机 << 系统属性 << 高级 << 环境变量
- ' 写注册项 (4, “SYSTEM\ControlSet001\Control\Session Manager\Environment\” + “adminw”, “zzzz”)
- ' 写注册项 (3, “Environment\” + “adminw”, “www66w”)
- Nt_Environment_RtlCreateEnvironment (真, Asm_GetH (Environment))
- name = Asm_GetDataH (“Path”) ' ComSpec cmd路径
- namelen = Asm_len (name) ' 取A编码长度
- Unicodelen = Asm_mul (Asm_len (name), 2) ' 取A编码长度*2=Unicodelen
- Unicode = Nt_Heap_RtlAllocateHeap (g_heap, Asm_add (#HEAP_ZERO_MEMORY, #HEAP_GENERATE_EXCEPTIONS), Unicodelen) ' 申请相应长度内存
- Nt_Trans_RtlMultiByteToUnicodeN (Unicode, Unicodelen, Asm_GetH (pUnicodelen), name, namelen) ' 传入地址转换编码
- Asm_writeWord_1 (punicode_string, pUnicodelen)
- Asm_writeWord__1 (punicode_string, 2, pUnicodelen)
- Asm_writeDword__1 (punicode_string, 4, Unicode)
- ' 输出调试文本 (Nt_Environment_RtlSetEnvironmentVariable (Asm_GetH (Environment), Asm_GetH (punicode_string), Asm_GetH (outpunicode_string)))
- outUnicode = Nt_Heap_RtlAllocateHeap (g_heap, Asm_add (#HEAP_ZERO_MEMORY, #HEAP_GENERATE_EXCEPTIONS), 10240) ' 申请相应长度内存
- Asm_writeWord_1 (outpunicode_string, 10240)
- Asm_writeWord__1 (outpunicode_string, 2, 10240)
- Asm_writeDword__1 (outpunicode_string, 4, outUnicode)
- Nt_Environment_RtlQueryEnvironmentVariable_U (Environment, Asm_GetH (punicode_string), Asm_GetH (outpunicode_string))
- 调试输出 (指针到字节集 (outUnicode, Asm_readWord (Asm_GetH (outpunicode_string))))
- ' 其他类似 不一一列举
- ' Nt_Environment_RtlExpandEnvironmentStrings_U 扩展环境路径名
- ' Nt_Environment_RtlSetCurrentEnvironment 置当前环境对象
- ' Nt_Environment_RtlSetEnvironmentVariable 置环境变量值
- Nt_Environment_RtlDestroyEnvironment (Environment) ' 关闭对象
复制代码
|