發表文章

FFmpeg 4.2 Hello World C++ FFmpeg : Extract Image (.BMP) from Video (.mp4) 從 視頻 (.mp4) 擷取 圖像 (.bmp) using Visual Studio 2019 參考 : https://github.com/leandromoreira/ffmpeg-libav-tutorial 1. Download include / lib / dll file from https://ffmpeg.zeranoe.com/builds/ Architecture option choose Windows 32-bit ,  Linking option choose Dev & Shared (Dev option has include & lib files , Shared option has dll files) 2.Set up C++ property  and  Linker property in project property (Note : Set Linker option SAFESEH:NO) 3. ---------------------------Source.cpp-------------------------------- #define _CRT_SECURE_NO_WARNINGS extern "C" { #include"libavcodec/avcodec.h" #include"libavformat/avformat.h" #include "libswscale/swscale.h" #include "libavutil/imgutils.h" } #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <inttypes.h> #include<Windo...
Discord 直播 1.  在聊天室貼上 https://discordapp.com/channels/伺服器ID/語音頻道ID  (將伺服器ID改成 你要的伺服器ID,語音頻道ID改成你要的語音頻道ID) 2. 在DISCORD的聊天室上點擊連結

C++ DirectX Draw Triangle

圖片
C++ DirectX Draw Triangle 1.Download Microsoft DirectX SDK (June 2010) Install it 2.  main.cpp // include the basic windows header files and the Direct3D header files #define UNICODE #include <windows.h> #include <windowsx.h> #include <d3d11.h> #include "G:\SDK\Microsoft DirectX SDK (June 2010)\Include\D3DX10.h" #include "G:\SDK\Microsoft DirectX SDK (June 2010)\Include\D3DX11.h" // include the Direct3D Library file #pragma comment (lib, "d3d11.lib") #pragma comment (lib, "G:\\SDK\\Microsoft DirectX SDK (June 2010)\\Lib\\x86\\d3dx11.lib") #pragma comment (lib, "G:\\SDK\\Microsoft DirectX SDK (June 2010)\\Lib\\x86\\d3dx10.lib") // define the screen resolution #define SCREEN_WIDTH  800 #define SCREEN_HEIGHT 600 // global declarations IDXGISwapChain *swapchain;             // the pointer to the swap chain interface ID3D11Device *dev;                  ...
C++ Virtual Function #include <iostream> using namespace std ; class Foo1 { public : virtual void show () { // 虛擬函式 cout << "Foo1's show" << endl ; } }; class Foo2 : public Foo1 { public : virtual void show () { // 虛擬函式 cout << "Foo2's show" << endl ; } }; void showFooByPtr ( Foo1 * foo ) { foo -> show (); } void showFooByRef ( Foo1 & foo ) { foo . show (); } int main () { Foo1 f1 ; Foo2 f2 ; // 動態繫結 showFooByPtr (& f1 ); showFooByPtr (& f2 ); cout << endl ; // 動態繫結 showFooByRef ( f1 ); showFooByRef ( f2 ); cout << endl ; // 靜態繫結 f1 . show (); f2 . show (); return 0 ; }
圖片
C++ Hooking (using Dev-C++ 5.11 on Windows) compile and run following .cpp file Virtual Function Hook --------------------------------------------------------------------------------------------------------------------------- #include<iostream> #include<windows.h> using namespace std; class C{     public:     virtual void VF(int); }; void C::VF(int a){     printf("VF is called\n") ; } typedef void (__thiscall* VF_type) (int ); VF_type org_VF; void __fastcall hk_VF(int a){     printf("hook func is called.\n");         org_VF(a); } int main(){     C* pC = new C();     void** base = *(void***)pC;         org_VF = (VF_type)base[0];     org_VF(0);         //DWORD oldProtection;     //VirtualProtect(base, 4, PAGE_EXECUTE_READWRITE, ...
Tool 1. tshark * 參考 : https://ithelp.ithome.com.tw/articles/10196772 [列出網卡資訊] >tshark -D [輸出成 pcap 檔] >tshark -i 8 -w C:\Users\BlackTea\Desktop\test.pcap 2. qemu [Boot from an .iso file but can't install ] >qemu-system-x86_64 -drive format=raw,media=cdrom,readonly,file=C:\Users\BlackTea\Downloads\ubuntu-16.04.6-desktop-amd64.iso -m 1024  (test in guest os) $sudo fdisk -l => /dev/loop0 .... 3. VirtualBox [ Convert .vdi to raw, qed, qcow2, vhd, vmdk ] Reference : https://medium.com/@lonardogio/convert-vdi-virtualbox-to-raw-in-windows-c96bded29640
Virtual Machine 一.qemu on Windows  >qemu-system-x86_64 -boot d -cdrom linux.iso -m 512