首页
社区
课程
招聘
[求助]哪位会Delphi的朋友帮忙将这两个c++函数给转换成Delphi?
发表于: 2008-5-14 16:54 4605

[求助]哪位会Delphi的朋友帮忙将这两个c++函数给转换成Delphi?

2008-5-14 16:54
4605
非常感谢。

HANDLE device;char outputbuff[256]; char * strings[256]; DWORD stringcount;

void thread()
{
DWORD a,x; char msgbuff[512];

while(1)
{
memmove(&a,&outputbuff[0],4);

//if nothing is there, Sleep() 10 ms and check again
if(!a){Sleep(10);continue;}

// looks like our permission is asked. If the file in question is already in the white list,
///give a positive response
char*name=(char*)&outputbuff[8];
for(x=0;x<stringcount;x++)
{
        if(!stricmp(name,strings[x])){a=1;goto skip;}
}

// ask user's permission to run the program
strcpy(msgbuff, "Do you want to run ");
strcat(msgbuff,&outputbuff[8]);

// if user's reply is positive, add the program to the white list
if(IDYES==MessageBox(0, msgbuff,"WARNING",MB_YESNO|MB_ICONQUESTION|0x00200000L))
{a=1; strings[stringcount]=_strdup(name);stringcount++;}
else a=0;

// write response to the buffer, and driver will get it
skip:memmove(&outputbuff[4],&a,4);

//tell the driver to go ahead
a=0;
memmove(&outputbuff[0],&a,4);
}

}

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
现在的关键就是delphi中,无法取得驱动中写回的信息,就是通过DeviceIoControl(device,1000,controlbuff,256,controlbuff,256,&dw,0)中,controlbuff指定的一个指针地址的值取不到,郁闷。。。
2008-5-15 11:16
0
雪    币: 325
活跃值: (97)
能力值: ( LV13,RANK:530 )
在线值:
发帖
回帖
粉丝
3
看起来好像很像 codeproject的一个例子YE。。
2008-5-15 17:12
0
游客
登录 | 注册 方可回帖
返回
//