bochs breakpoint panel

extended netbeans, auto scan .c/.cc/.cpp files to find my bochs breakpoint marco, double click it will jump to there. Small tool, but save me a lot of time.pause_bochs-panel

read count : 11

Visual c++ example to read mbr

Install windows ddk and run it using admin permission, otherwise all bytes that read from mbr are 0xcd. It can be compile using visual c++ community exition.

virus

#include "stdafx.h"
#include <cstdlib>
#include <windows.h>
#include <stdio.h>
#include <iostream>
#define FILE_SHARE_VALID_FLAGS (0x00000007) 
using namespace std;

short ReadSect
(
	const char *_dsk,    // disk to access
	char *&_buff,         // buffer where sector will be stored
	unsigned int _nsect   // sector number, starting with 0
)
{
	DWORD dwRead;
	wchar_t wdsk[100];
	size_t count;
	mbstowcs_s(&count, wdsk, sizeof(wdsk) / sizeof(wdsk[0]), _dsk, _TRUNCATE);
	HANDLE hDisk = CreateFile(wdsk, GENERIC_READ, FILE_SHARE_VALID_FLAGS, 0, OPEN_EXISTING, 0, 0);
	if (hDisk == INVALID_HANDLE_VALUE) // this may happen if another program is already reading from disk
	{
		CloseHandle(hDisk);
		return 1;
	}
	SetFilePointer(hDisk, _nsect * 512, 0, FILE_BEGIN); // which sector to read

	ReadFile(hDisk, _buff, 512, &dwRead, 0);  // read sector
	CloseHandle(hDisk);
	return 0;
}

int main()
{
	char *dsk = "\\\\.\\PhysicalDrive0";
	int sector = 0;

	char *buff = new char[512];
	ReadSect(dsk, buff, sector);
	for (int x = 0; x < 512; x++) {
		printf("%x ", buff[x] & 0xff);
	}
	if ((unsigned char)buff[510] == 0x55 && (unsigned char)buff[511] == 0xaa) {
		cout << "Disk is bootable!" << endl;
	}

	getchar();
	return 0;
}

read count : 8

ffmpeg and ffplay for logitech webcam

These command works on windows and capture video using my logitech C920 webcam

Save viewcam to a file, becareful, windows media play may not able to play mp4 in a very clean windows. You can save it to avi.

ffmpeg -f dshow -i video="Logitech HD Pro Webcam C920" -c copy -y c:\users\peter\desktop\a.mp4

Save viewcam video and play it using ffplay, but it has few seconds delay

ffmpeg -f dshow -i video="Logitech HD Pro Webcam C920" -c copy -y c:\users\peter\desktop\a.mp4 -c:v copy -copytb 1 -an -f mjpeg udp://127.0.0.1:1234/ | ffplay -f mjpeg p-rpbesize 32 udp://127.0.0.1:1234

Just play it by ffplay

ffmpeg -f dshow -i video="Logitech HD Pro Webcam C920" -c:v copy -copytb 1 -an -f mjpeg udp://127.0.0.1:1234/ | ffplay -f mjpeg -probesize 32 udp://127.0.0.1:1234

https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2421

read count : 5

Quantum physics and “rules”

Quantum physicist said even the smallest things are so random and unpredictable, when the number of thing is high enough, it will come out a stable “average value”, when is “order”. So why micro economic make sense?

read count : 7

my crazy kmalloc bug

i was assume the continous linear addresses are in same 2nd level page table, so i was in shit for few months. The probabilities of this bug is 1/4096, hard to discover. kmalloc-bug

read count : 3

Stock data filtering

I need to filter all stock/index data into different table/database engine for further analysis, because it is huge amount of records. So far I have basic monitor tool to monitor all grabbers, but i need more advance tool to monitor so much real time data.

stockmonitor filtering engine

 

stock monitor
stock monitor

read count : 9

When malloc has a bug

When malloc has a bug that not always happen, OS becoming crazy and very very hard to debug. I added “custom panel” in GKD to help me to analyst the behavior of each step of the malloc code, it is a great improvement but still super hard to debug.

custom-panel

read count : 9