Some of you have seen some new tags that I have been playing around with. I wanted to make code tags look "neater" and easier to read so after some trial and error I got it working.
If you're interested in using them, read below on instructions how to use them in your posts.
NOTE: In the “Usage” area, make sure to remove the underscore “_” to properly use the code tags.
Note2: In the "Usage" area you can replace the "cpp" with any of the xcode symbols below according to the language you are posting.
Usage:
[_xcode=cpp]
source
[/_xcode]
List of Available Language Syntax support
AppleScript
Proper xcode symbols: ['applescript'];
ActionScript
Proper xcode symbols: ['actionscript3', 'as3'];
Auto Hotkey
Proper xcode symbols: ['ahk', 'autohotkey'];
Asm
Proper xcode symbols: ['nasm8086','8086','nasm','asm','masm'];
Bash
Proper xcode symbols: ['bash', 'shell', 'sh'];
ColdFusion
Proper xcode symbols: ['coldfusion','cf'];
Cpp
Proper xcode symbols: ['cpp', 'cc', 'c++', 'c', 'h', 'hpp', 'h++'];
CSharp
Proper xcode symbols: ['c#', 'c-sharp', 'csharp'];
Css
Proper xcode symbols: ['css'];
Delphi
Proper xcode symbols: ['delphi', 'pascal', 'pas'];
Diff
Proper xcode symbols: ['diff', 'patch'];
Erlang
Proper xcode symbols: ['erl', 'erlang'];
Groovy
Proper xcode symbols: ['groovy'];
Java
Proper xcode symbols: ['java'];
JavaFX
Proper xcode symbols: ['jfx', 'javafx'];
JScript
Proper xcode symbols: ['js', 'jscript', 'javascript', 'json'];
Perl
Proper xcode symbols: ['perl', 'Perl', 'pl'];
Php
Proper xcode symbols: ['php'];
Plain
Proper xcode symbols: ['text', 'plain'];
PowerShell
Proper xcode symbols: ['powershell', 'ps', 'posh'];
Python
Proper xcode symbols: ['py', 'python'];
Ruby
Proper xcode symbols: ['ruby', 'rails', 'ror', 'rb'];
Sass
Proper xcode symbols: ['sass', 'scss'];
Scala
Proper xcode symbols: ['scala'];
Sql
Proper xcode symbols: [‘sql’];
TypeScript
Proper xcode symbols: ['ts', 'typescript'];
Vb
Proper xcode symbols: ['vb', 'vbnet'];
Xml
Proper xcode symbols: ['xml', 'xhtml', 'xslt', 'html', 'plist'];
Example using c++ syntax highlighting
#define _CRT_SECURE_NO_WARNINGS
#include "MHC-cache.h"
#include <ctime>
#include <fstream>
#include <sys/stat.h>
//HWND pleaseWait = FindWindow("TfrmWait", "Please Wait...");
//HWND cancelButton = FindWindowEx( pleaseWait, NULL, NULL, "Cancel" );
DWORD DetourPatchcall( PBYTE pSrc, PBYTE pDst, BOOL bForce )
{
DWORD dwOrgCallDest = 0;
DWORD dwOldProtection = 0;
DWORD dwRel = 0;
if(!pSrc || !pDst)
return (0);
if( *pSrc == 0xE8 || bForce )
{
if( *pSrc == 0xE8 )
{
dwRel = *(DWORD*)( pSrc + 1 );
dwOrgCallDest = ( (DWORD)pSrc + dwRel + 0x5 );
}
else
{
dwOrgCallDest = 1; // return 1 means no original call at pSrc
}
#ifdef WIN32
if( !VirtualProtect( (PVOID)pSrc, 0x1000, PAGE_EXECUTE_READWRITE, &dwOldProtection ) )
return (0);
#else
unprotect( GET_PAGE( pSrc ), 4096 );
if ( ( ( (unsigned long)pSrc ) & 0xfff ) > 0xff9 )
unprotect( GET_PAGE( pSrc + 4096 ), 4096 );
#endif
*pSrc = 0xE8;
*( DWORD* )( pSrc + 1 ) = (DWORD)( pDst - pSrc - 5 );
#ifdef WIN32
VirtualProtect( (PVOID)pSrc, 0x1000, dwOldProtection, &dwOldProtection );
#endif
return dwOrgCallDest;
}
return (0);
}
//This function is called for users that toggle between host and field mode ONLY
void __stdcall callMaintenanceForHostAndField()
{
HWND pleaseWait = FindWindow("TfrmWait", "Please Wait...");
HWND cancelButton = FindWindowEx( pleaseWait, NULL, NULL, "Cancel" );
WriteMemory( ForceCacheMaintenanceOnExitAddress, (BYTE*)"\xEB", 1 ); //0x01C9CBEA
_asm
{
pushad
pushfd
mov edx, OffsetForHostAndField //0x1C7C4C0
call edx
xor ecx, ecx
mov dl, 0
mov ebx, callMaintenanceForHostAndFieldAddress //0x01C9CB54
call ebx
popfd
popad
}
Sleep(250);
// Simulate a key press
keybd_event( VK_RETURN, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
// Simulate a key release
keybd_event( VK_RETURN, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
//Hide the Cancel button on the cache maintenance screen
if(cancelButton)
ShowWindow(cancelButton, SW_HIDE);
}