Windows API简单项目演示实例

# WINDOWS API 项目实例
##### 注册表开机项控制
```
#include <iostream>

#include <Windows.h>



int main()

{

    /*

    WINDOWS开机启动注册表:

    1.(易被杀软检测修改注册表)添加键值-》"HKEY_LOCAL_MACHINE\\SoftWare\\Microsoft\\Windows\\CurrentVersion\\Run"

    2.(白名单修改注册表,不易被检测)添加键值-》""

    HKEY_CURRENT_USER\Software\Microsoft\WindowsNT\CurrentVersion\Windows\load

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft 
\WindowsNT\CurrentVersion\Winlogon\Useinit

    HKEY_CURRENT_USER\Software 
\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies 
\Explorer\Run

    服务启动:

    HKEY_CURRENT_USER\Software \Microsoft\Windows\CurrentVersion\RunServicesOnce

    HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce

    详细:注册表十大启动项

    */



    HKEY hkey = 0;

    //64Bit系统 :KEY_WOW64_64KEY

    RegOpenKeyExA(HKEY_LOCAL_MACHINE, 
"SoftWare\\Microsoft\\Windows\\CurrentVersion\\Run", NULL, KEY_WRITE | 
KEY_WOW64_64KEY, &hkey);

    RegSetKeyValueA(hkey, NULL, "FORTEST", REG_SZ, "THISTEST", 
strlen("THISTEST"));



}


```
##### windowsAPI之下载API
```
#include <iostream>
#include <Windows.h>
#include <urlmon.h>
#pragma comment(lib,"urlmon.lib")

//从Internet下载位并将其保存到文件中。


int main(int argv,char* argc[])
{

       char szurl[] = "https://youimg1.c-ctrip.com/target/1009050000000s4w4D190.jpg";
       char szpath[] = "c:\\Download.jpg";


       URLDownloadToFileA(NULL, argc[1], argc[2], 0, 0);

       return 0;

}

```
##### PS:python下载文件脚本
```

response_data_file = requests.get(url, stream=True) 
    with  open(file_pname, 'wb') as f: 
    for chunk in response_data_file.iter_content(chunk_size=chunk_size):               if chunk: 
                f.write(chunk)
```

 

posted @ 2021-06-21 21:45  y0um  阅读(144)  评论(0编辑  收藏  举报

新人优惠服务器