/* class Comparator { public: bool operator()(const HWND hwnd1,const HWND hwnd2)const{return (int)hwnd1<(int)hwnd2;} }; typedef map WinMap; WinMap smWinMap; */ #include #include #include int messageLoop(void); void yield(); #include #include class CBTHook; typedef ProcAddress CBTHookProc; //class CBTHook : protected APIEntry, private CBTHookProc class CBTHook : protected APIEntry, private CBTHookProc { public: typedef LRESULT (__stdcall *LPFNCBTPROC)(int nCode,WPARAM wParam,LPARAM lParam); CBTHook(); virtual ~CBTHook(); DWORD getHookAddress(void); protected: virtual LRESULT handleActive(WPARAM wParam,LPARAM lParam); virtual LRESULT handleClickSkipped(WPARAM wParam,LPARAM lParam); virtual LRESULT handleCreateWnd(WPARAM wParam,LPARAM lParam); virtual LRESULT handleDestroyWnd(WPARAM wParam,LPARAM lParam); virtual LRESULT handleKeySkipped(WPARAM wParam,LPARAM lParam); virtual LRESULT handleMinMax(WPARAM wParam,LPARAM lParam); virtual LRESULT handleMoveSize(WPARAM wParam,LPARAM lParam); virtual LRESULT handleQs(WPARAM wParam,LPARAM lParam); virtual LRESULT handleSetFocus(WPARAM wParam,LPARAM lParam); virtual LRESULT handleSysCommand(WPARAM wParam,LPARAM lParam); private: enum {ParamLength=12}; CBTHook &operator=(const CBTHook &cbtHook); LRESULT entryProc(int nCode,WPARAM wParam,LPARAM lParam); HHOOK mhHook; }; inline CBTHook::CBTHook(void) : APIEntry(ParamLength,(DWORD)this,getProcAddress((ProcAddress::LPFNMETHODVOID)&CBTHook::entryProc)), mhHook(0) { HINSTANCE hProcessInstance=(HINSTANCE)::GetModuleHandle(0); mhHook=::SetWindowsHookEx(WH_CBT,(HOOKPROC)getHookAddress(),hProcessInstance,0); } inline CBTHook::~CBTHook() { if(!mhHook)return; ::UnhookWindowsHookEx(mhHook); } inline CBTHook &CBTHook::operator=(const CBTHook &cbtHook) { // no implementation return *this; } inline DWORD CBTHook::getHookAddress(void) { return codeBase(); } inline LRESULT CBTHook::entryProc(int nCode,WPARAM wParam,LPARAM lParam) { LRESULT result; ::printf("[CBTHook::entryProc]\n"); if(nCode<0)return result=::CallNextHookEx(mhHook,nCode,wParam,lParam); switch(nCode) { case HCBT_ACTIVATE : result=handleActive(wParam,lParam); break; case HCBT_CLICKSKIPPED : result=handleClickSkipped(wParam,lParam); break; case HCBT_CREATEWND : result=handleCreateWnd(wParam,lParam); break; case HCBT_DESTROYWND : result=handleDestroyWnd(wParam,lParam); break; case HCBT_KEYSKIPPED : result=handleKeySkipped(wParam,lParam); break; case HCBT_MINMAX : result=handleMinMax(wParam,lParam); break; case HCBT_MOVESIZE : result=handleMoveSize(wParam,lParam); break; case HCBT_QS : result=handleQs(wParam,lParam); break; case HCBT_SETFOCUS : result=handleSetFocus(wParam,lParam); break; case HCBT_SYSCOMMAND : result=handleSysCommand(wParam,lParam); break; } return result; } // *** virtuals inline LRESULT CBTHook::handleActive(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleClickSkipped(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleCreateWnd(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleDestroyWnd(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleKeySkipped(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleMinMax(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleMoveSize(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleQs(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleSetFocus(WPARAM wParam,LPARAM lParam) { return 0; } inline LRESULT CBTHook::handleSysCommand(WPARAM wParam,LPARAM lParam) { return 0; } // ********************************************************************************************* class WinCreateHook : public CBTHook { public: WinCreateHook(); virtual ~WinCreateHook(); protected: virtual LRESULT handleCreateWnd(WPARAM wParam,LPARAM lParam); private: }; inline WinCreateHook::WinCreateHook() { } inline WinCreateHook::~WinCreateHook() { } inline LRESULT WinCreateHook::handleCreateWnd(WPARAM wParam,LPARAM lParam) { ::printf("[WinCreateHook::handleCreateWnd]"); return 0; } // ********************************************************************************************* extern "C" { __declspec(dllimport) bool FAR PASCAL unHook(void); __declspec(dllimport) bool FAR PASCAL setHook(void); } void main(int argc,char **argv) { // Library library("cbtdll.dll"); // HHOOK mhHook; // mhHook=::SetWindowsHookEx(WH_CBT,(HOOKPROC)&cbtHookProc,0,0); // mhHook=::SetWindowsHookEx(WH_CBT,(HOOKPROC)&cbtHookProc,library.getInstance(),0); /* if(!library.isOkay()) { ::printf("Library not found"); return; } if(!library.procAddress("_cbtHookProc")) { ::printf("Address not found"); return; } mhHook=::SetWindowsHookEx(WH_CBT,(HOOKPROC)library.procAddress("cbtHookProc"),library.getInstance(),0); */ if(!setHook())return; for(int index=0;index<120;index++) { yield(); ::Sleep(250); } unHook(); // HINSTANCE hProcessInstance=(HINSTANCE)::GetModuleHandle(0); // ::printf("main hInst=0x%08lx",hProcessInstance); // cbtHookProc(0,0,0); /* // Event event; CBTHook cbtHook; for(;;) { yield(); ::Sleep(250); } // messageLoop(); // event.waitEvent(); */ return; } int messageLoop(void) { MSG msg; while(::GetMessage(&msg,NULL,0,0)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } return msg.wParam; } void yield() { MSG msg; if(::PeekMessage(&msg,0,0,0,PM_REMOVE)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } } File inFile; File outFile; String strLine; String midiLine; String saveLine; String www; www="www.burksstudios.com"; if(!inFile.open("d:\\midi.txt","rb"))return false; outFile.open("d:\\getpage.txt","wb"); while(inFile.readLine(strLine)) { midiLine=strLine.betweenString('"','"'); if(midiLine.isNull())continue; Profile::makeFileName(midiLine,saveLine); outFile.writeLine(www+String(" ")+String("http://")+www+String("/jazz/")+midiLine+String(" d:\\")+saveLine); } return 1; /* #include #include #include void main(int argc,char **argv) { MIDIOutputDevice midiOut; NoteOn noteOn(PureNote(65,70)); if(!midiOut.openDevice())return; for(int prog=0;prog<128;prog++) { midiOut.midiEvent(ProgramChange(prog).getEvent(0,16)); PureEvent &midiEvent=noteOn.getEvent(); midiOut.midiEvent(midiEvent); ::Sleep(250); } // PureEvent getEvent(BYTE deltaTime=0,BYTE channel=0)const; // PureEvent(BYTE eventType,DWORD deltaTime,BYTE channel,BYTE firstData,BYTE secondData,DWORD tempo=0); midiOut.closeDevice(); return; } */ /* 35 Acoustic Bass Drum 59 Ride Cymbal 2 36 Bass Drum 1 60 Hi Bongo 37 Side Stick 61 Low Bongo 38 Acoustic Snare 62 Mute Hi Conga 39 Hand Clap 63 Open Hi Conga 40 Electric Snare 64 Low Conga 41 Low Floor Tom 65 High Timbale 42 Closed Hi-Hat 66 Low Timbale 43 High Floor Tom 67 High Agogo 44 Pedal Hi-Hat 68 Low Agogo 45 Low Tom 69 Cabasa 46 Open Hi-Hat 70 Maracas 47 Low-Mid Tom 71 Short Whistle 48 Hi-Mid Tom 72 Long Whistle 49 Crash Cymbal 1 73 Short Guiro 50 High Tom 74 Long Guiro 51 Ride Cymbal 1 75 Claves 52 Chinese Cymbal 76 Hi Wood Block 53 Ride Bell 77 Low Wood Block 54 Tambourine 78 Mute Cuica 55 Splash Cymbal 79 Open Cuica 56 Cowbell 80 Mute Triangle 57 Crash Cymbal 2 81 Open Triangle 58 Vibraslap */ /* bool ClassMapper::createClass(const String &packageName,const String &className,const String &strPathMapFile,const String &strPathTable) { File inFile; File outFile; String strLine; String name; String value; String methodName; Block variables; int errors=0; if(!loadMapping(strPathMapFile))return false; if(!inFile.open(strPathTable,"rb"))return false; while(true) { inFile.readLine(strLine); if(strLine.isNull())break; name=strLine.betweenString(' ',' '); name=makeHungarian(name); value=strLine.betweenString(' ',0).betweenString(' ',' '); if(!mapType(value,value)) { printf("Don't know how to map %s\n",value.str()); errors++; continue; } variables.insert(&NameValuePair(name,value)); } inFile.close(); if(errors)return false; if(!variables.size())return false; if(!outFile.open(className+String(".java"),"wb"))return false; if(!packageName.isNull())outFile.writeLine(String("package ")+packageName); outFile.writeLine("\t"); outFile.writeLine("\t"); outFile.writeLine(String("public class ")+className); outFile.writeLine("{"); for(int index=0;index variables; Block originals; int errors=0; if(!loadMapping(strPathMapFile))return false; if(!inFile.open(strPathTable,"rb"))return false; while(true) { inFile.readLine(strLine); if(strLine.isNull())break; name=strLine.betweenString(' ',' '); value=strLine.betweenString(' ',0).betweenString(' ',' '); if(!mapType(value,value)) { printf("Don't know how to map %s\n",value.str()); errors++; continue; } variables.insert(&NameValuePair(makeHungarian(name),value)); originals.insert(&NameValuePair(name,value)); } inFile.close(); if(errors)return false; if(!variables.size())return false; if(!outFile.open(className+String("RS")+String(".java"),"wb"))return false; if(!packageName.isNull())outFile.writeLine(String("package ")+packageName); outFile.writeLine("\t"); outFile.writeLine("\t"); outFile.writeLine("public void processResult()"); outFile.writeLine("{"); outFile.writeLine(String(" ")+className+String(" ")+instanceName+String(";")); outFile.writeLine(" ResultSet rs;"); outFile.writeLine("// fill in the blanks"); for(int index=0;index #include #include #include #include #include #include #include #include #include void displayMemory(); void displayProcesses(); void showModule(const String &pathFileName); void showVersionInfo(const ModuleInfo &moduleInfo,String &moduleBaseName,String &moduleFileName); void displayAutoRuns(); int main(int argc,char **argv) { return 0; } void displayAutoRuns() { } void displayProcesses() { ProcessIDList processIDList; ProcessAPI processAPI; ModuleInfoList moduleInfoList; processAPI.enumProcesses(processIDList); for(int index=0;index imageImportDescriptors; ImageSectionHeader imageSectionHeader; FileHandle inFile(moduleFileName,FileHandle::Read); if(!inFile.isOkay())return; FileMap inMap(inFile); PureViewOfFile view(inMap); peHeader<