avatar
Articles
286
Tags
104
Categories
25

Theqiqi_blog
Search

Theqiqi_blog

6.使用C语言将PCM文件编码成WAV文件
Created2024-08-21|C_Sound|C•Sound
[toc] C语言将PCM编码成WAV文件 准备一个pcm文件 编写代码并编译main.exe 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdint.h>#include <assert.h>#include <sys/stat.h>#pragma warning(disable:4996)size_t getFileSize(const char* filename) { struct stat st; if (stat(f ...
使用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 ...
1…151617…29
avatar
Theqiqi
Articles
286
Tags
104
Categories
25
Follow Me
Announcement
This is my Blog
Recent Post
101.使用Grop网站提供的api2026-01-03
9.压测2025-03-27
8.Linux Socket并发模型http服务器2025-03-27
7.web服务器中收发REST接口2025-03-27
6使用c语言与linux系统写一个web服务器,解析并响应get与post请求2025-03-27
Categories
  • C with Socks16
  • C_Sound10
  • C_Windows_Graphi9
  • Cpp5
  • Cpp_Socket4
  • C语言在Windows中实现抓包4
  • C语言的万种用法9
  • Debian1
Tags
cmake Cmake ipv4 x86汇编程序 Hacking LinuxDriver Python C++ android c_windows_driver Drvier epoll Piano OpenGl Disk linux MySql web Ethernet WindowsDrive jsp gtest html poll LinSock first pragram AI UART javascript System C http opencv Sound system PVE Hook Graphi Qt5.8 c语言的万种用法
Archives
  • January 20261
  • March 202595
  • February 202523
  • September 20242
  • August 202471
  • June 20242
  • March 202443
  • February 20248
Info
Article :
286
UV :
PV :
Last Update :
©2020 - 2026 By Theqiqi
Framework Hexo|Theme Butterfly
Search
Loading the Database