avatar
Articles
415
Tags
259
Categories
26

Theqiqi_blog
Search

Theqiqi_blog

使用C语言在Windows中录制一个PCM音频文件
Created2024-08-21|C_Sound|C•Sound
[toc] 使用C语言在Windows中录制一个PCM音频文件12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879#define _CRT_SECURE_NO_WARNINGS#include <windows.h>#include <mmsystem.h>#include <stdio.h>#pragma comment(lib, "winmm.lib")#define BUFFER_SIZE 44100 // 1 second of audio at 44.1kHz#define SAMPLE_RATE 44100#define NUM_CHANNELS 1#define BITS_PER_SAMPLE 16typedef struct { WAVEHDR head ...
3.使用C语言在Windows中创建PCM格式的音频文件
Created2024-08-20|C_Sound|C•Sound
[toc] 使用C语言在Windows中创建PCM格式的音频文件PCM文件里面存储的是经过数模转换后存储的二进制文件,需要支持的播放器才能播放。 1.保存do re mi fa so la ti do到PCM文件中12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdint.h>#include <stdlib.h>#include <math.h>// 定义 M_PI#ifndef M_PI#define M_PI 3.14159265358979323846#endif#define SAMPLE_RATE 44100#define NUM_CHANNELS 1#define BITS_PER_SAMPLE 16#define DURATION 0.25 // 每 ...
3.使用C语言在Windows中创建WAV格式的音频文件
Created2024-08-20|C_Sound|C•Sound
[toc] 使用C语言在Windows中创建WAV格式的音频文件1. 创建WAV格式的音频文件12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <math.h>#include <stdint.h>#include <string.h>#include <stdlib.h>#define SAMPLE_RATE 44100#define DURATION 0.1 // 每个音符的持续时间(秒)#define AMPLITUDE 32767 // 最大振幅(16位音频)// 定义 M_PI#ifndef M_PI#define M_ ...
2.C语言在Windows中播放特定频率的声音
Created2024-08-20|C_Sound|C•Sound
[toc] C语言在Windows中播放特定频率的声音1.C语言在Windows中使用Beep播放特定频率的声音12345678910111213141516171819#include <windows.h>#include <stdio.h>int main() { // 播放432Hz的声音,持续0.5秒 Beep(432, 500); // 播放440Hz的声音,持续0.5秒 Beep(440, 500); // 播放1000Hz的声音,持续0.5秒 Beep(1000, 500); // 播放2000Hz的声音,持续0.5秒 Beep(2000, 500); return 0;} 2.C语言在Windows中使用waveOut播放特定频率的声音1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 ...
2.3.C语言在Windows中播放do_ re _mi_fa_so_la _ti_do
Created2024-08-20|C_Sound|C•Sound
[toc] C语言在Windows中播放乐谱1.C语言在Windows中通过音符相关函数播放一秒432HZ的声音123456789101112131415161718192021222324252627282930#include <stdio.h>#include <windows.h>#include <math.h>#pragma comment(lib, "winmm.lib")void PlayTone(double frequency, int duration) { HMIDIOUT handle; midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL); int volume = 0x7f; // 最大音量 int sleep = duration; // 每个音符的持续时间 // 计算432Hz对应的MIDI音符 int midiNote = (int)(69 + 12 * log2(frequency / 440.0)) ...
33.在x86_64中不用call指令修改返回地址调用函数
Created2024-08-16|c+windows+hacking|assembly•C•Windows•Hacking
在x86_64中不用call指令修改返回地址调用函数修改返回地址调用函数hello 准备环境vs2022。 start.asm 123456789101112131415161718192021222324252627282930313233343536373839404142434445;assembly.asmextrn hello : PROC.codefunnormal PROC; 正常调用函数 ; shadow space 32 bytes sub rsp, 40 ; 保持16字节对齐 + 预留 shadow space mov ecx, 123 ; RCX = 第一个参数(Windows x64 ABI) call hello ; 正常调用函数 add rsp, 40 xor eax, eax ; return 0 retfunnormal ENDPvulnerable PROC;修改返回地址调用函数 push rbp mov rbp, rsp ; retu ...
32.设置断点与无痕Hook的原理
Created2024-08-16|c+windows+hacking|C•Windows•Hacking
无痕Hook的原理1.C语言使用VirtualAlloc分配内存后写入指令调用12345678910111213141516171819202122232425262728293031323334353637383940#include <stdio.h>#include <windows.h>void test(){ // 使用 VirtualAlloc 分配内存,确保内存页面可执行 SIZE_T size = 1; // 1 字节的内存 unsigned char* arry = (unsigned char*)VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (arry == NULL) { printf("Memory allocation failed.\n"); return; } // 将内存填充为 RET 指令 ar ...
31.C语言在windows中捕获异常
Created2024-08-16|c+windows+hacking|C•Windows•Hacking
Windows捕获会引起程序崩溃的异常1.给空指针赋值引起的异常(__try __except)访问冲突(Access Violation): 这通常发生在尝试访问无效或不可访问的内存地址时,例如空指针解引用或访问已释放的内存。 示例:int* ptr = NULL; *ptr = 5; 或 free(ptr); ptr = NULL; *ptr = 10; 123456789101112131415161718192021#include <windows.h>#include <stdio.h>void test() { __try { // 这里执行可能会抛出异常的代码 int* ptr = NULL; *ptr = 42; // 这会触发访问冲突异常 } __except (EXCEPTION_EXECUTE_HANDLER) { // 捕获异常并处理 printf("An exception occurred! ...
30.使用C语言在windows中用数组执行机器指令
Created2024-08-16|c+windows+hacking|C•Windows•Hacking
[toc] 一、在C语言中直接使用数组执行机器指令1.写一个C语言程序,内容为调用MessageBoxA弹出一个消息框12345678910111213141516#include <stdio.h>#include <string.h>#include <windows.h>void MessageC(){ MessageBoxA(0,"MessageC", 0, 0); return;}int main() { MessageC(); return 0;} 2.写一个C语言程序,内容为使用x86内联汇编调用MessageBoxA弹出一个消息框12345678910111213141516171819202122232425#include <stdio.h>#include <string.h>#include <windows.h>void MessageA(){ char *message = &quo ...
28.C语言在Windows中获得system权限的方法
Created2024-08-16|c+windows+hacking|C•Windows•Hacking
[toc] 利用系统进程来创建新的进程lsass.exe系统中没有加载kernel32.dll,只有ntdll.dll,需要先将kernel32.dll注入到lsass.exe进程中 1.使用CreateProcessWithTokenW获取其他进程令牌来创建新的进程之前的文章写过: 6.使用C语言在windows中创建线程与进程并且创建具有system权限进程 C:\Windows\System32\kernel32.dll 2. 将Dll注入到系统进程中弹出cmd程序 编写x86_64位dll程序并编译 将Dll注入到拥有系统权限进程winlogn.exe的程序中,系统如果有两个winlogn.exe会有一个没效果,注入器需要有管理员与Debug权限 完整代码,功能为创建一个cmd.exe 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960//dllmain.c#include <Windows ...
1…282930…42
avatar
Theqiqi
Articles
415
Tags
259
Categories
26
Follow Me
Announcement
This is my Blog
Recent Post
03-反馈流2026-08-21
02-错误流2026-08-21
01-控制流2026-08-20
05-多系统协作的十条流2026-08-19
04-多层系统的十条流2026-08-18
Categories
  • C with Socks16
  • C_Sound10
  • C_Windows_Graphi9
  • Cpp5
  • Cpp_Socket4
  • C语言在Windows中实现抓包4
  • C语言的万种用法9
  • Debian1
Tags
十阶段 接口先行 Qt主题架构 WindowsDriver python 从输入到交互 select LinuxDriver 入口系统 UDP服务器与可靠性 微服务与组装边界 DLL javascript 多系统组成的网络通信软件 Piano 拆解资源 游戏类型演化 Kali 建模与逆向 BSD Sockets x86汇编程序 IPV4 Drvier 认知能力分解 技术流 qemu Ninja 业务流程到功能点 用头文件验证依赖 引擎组装 Sound 从状态到系统 epoll QEMU 依赖接口 shell 依赖关系 Graphi 拆解美术 只有组件的子系统如何被加载
Archives
  • August 2026128
  • January 20261
  • April 20251
  • March 202595
  • February 202523
  • September 20242
  • August 202471
  • June 20242
Info
Article :
415
UV :
PV :
Last Update :
©2020 - 2026 By Theqiqi
Framework Hexo|Theme Butterfly
Search
Loading the Database