English 中文(简体)
如何读用C版从书记官处钥匙中储存的价值
原标题:How to read the value stored in a Key from the Registry using C

Hi I m试图读用C代码储存在登记处钥匙上的价值。 我尝试了以下法典。 它不会产生任何汇编错误。 但是,我只收到第一封插图信作为产出。 我的法典样本

#include "stdafx.h"
#include <windows.h>
#include <malloc.h>
#include <stdio.h>



#define TOTALBYTES    8192
#define BYTEINCREMENT 4096
#define BUFFER 8192



int _tmain(int argc, _TCHAR* argv[])
{
char value[255];
DWORD BufferSize = BUFFER;
RegGetValue(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\Test\subkey"), TEXT("blockedurlslist"), RRF_RT_ANY, NULL, (PVOID)&value, &BufferSize);
printf("%s",value);
system("pause");
}

如果有人提出想法,请帮助我

问题回答

开始时,你没有检查是否接过了<代码>RegGetValue的电话。 航道检查了Win32APICA电话的返回价值。

但是,正在发生的情况相当清楚。 每当一项职能只恢复第一种特性的扼杀时,最可能的原因是,该功能正在退回UTF-16数据,你将这些数据解释为ANSI。 你的扼杀将包含一种英语特征,在UTF-16中被编码为二英特。 当被解释为ANSI时,0被作为扼杀装置对待。

您必须宣布,你的缓冲地带含有广泛的有效载荷。 由于你正在使用<代码>TCHAR,你愿意这样做:

TCHAR value[255];

缓冲面积是

DWORD BufferSize = sizeof(value);

您需要修改<条码>印本/代码>,以便能够打印出大体。

如果是你,我将不使用<代码>TCHAR。 我建议你决定在整个法典中使用统法协会编码。 这使你更容易理解,我怀疑你需要支持Windows 98。

恢复这一呼吁是什么? 如果它不退回<代码>ERROR_SUCCESS,它就失败了。 在要求了解APIC申请返回的数据之后,你可以检查<代码>BufferSize的价值。

正如在评论中指出的,你应当说:

char value[BUFFER];
DWORD BufferSize = sizeof value;

从现在起,你就转而向安森传递关于你的缓冲规模的图谋。

也许它把16个轨道特性中的回归数据推回,并且你用8个轨道电话重新印刷,从而将中间0个字节用作扼杀装置。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签