Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include amxmodx
- #include amxmisc
- #include orpheu
- #include orpheu_memory
- #include orpheu_advanced
- #define PLUGIN_NAME "Check files by OSTROG"
- #define PLUGIN_VERSION "1.0"
- #define PLUGIN_AUTHOR "OSTROG"
- #define CONFIG_PATH "addons/amxmodx/configs/ost_path_list.ini"
- #define ORPHEU_FUNCTIONS_PATH "addons/amxmodx/configs/orpheu/functions/"
- #define ORPHEU_MEMORY_PATH "addons/amxmodx/configs/orpheu/memory/"
- #define CONSOLE_PRINT_PREFIX "[OST Check Files] "
- #define CONSOLE_PRINT_ERROR_PREFIX "[ERROR] "
- static NAME_CMD_PATH[] = "add_path"
- static CHAR_PATH_W_B[] = "["
- static CHAR_PATH_W_E[] = "]"
- static CHAR_PATH_R_E[] = "="
- static CONFIG_SAVE[] = {
- 0x2f,0x2f,0x20,0x20,0xd0,0x9a,0xd0,0xbe,0xd0,0xbd,0xd1,0x84,0xd0,0xb8,0xd0,0xb3,0x20,0xd1,0x81,0x20,0xd0,0xbd,0xd0,0xb0,0xd1,0x81,0xd1,0x82,0xd1,0x80,0xd0,0xbe,0xd0,0xb9,0xd0,0xba,0xd0,0xb0,0xd0,0xbc,0xd0,0xb8,0x3a,0xd,0xa,0x2f,0x2f,0x20,0x20,0x20,0x20,0xd0,0x9a,0xd0,0xbe,0xd0,0xbc,0xd0,0xb0,0xd0,0xbd,0xd0,0xb4,0xd0,
- 0xb0,0x20,0xd0,0xb8,0xd0,0xbc,0xd0,0xb5,0xd0,0xb5,0xd1,0x82,0x20,0xd1,0x81,0xd0,0xbb,0xd0,0xb5,0xd0,0xb4,0xd1,0x83,0xd1,0x8e,0xd1,0x89,0xd0,0xb8,0xd0,0xb9,0x20,0xd0,0xbf,0xd1,0x80,0xd0,0xbe,0xd1,0x82,0xd0,0xbe,0xd1,0x82,0xd0,0xb8,0xd0,0xbf,0x3a,0xd,0xa,0x2f,0x2f,0x20,0x20,0x20,0x20,0x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d0,0xb5,0xd1,0x82,0xd1,0x83,0x2e,0xd,0xa,0xd,0xa,0x61,0x64,0x64,0x5f,0x70,0x61,0x74,0x68,0x5b,0x20,0x6b,0x69,0x63,0x6b,0x20,0x22,0x25,0x6e,0x22,0x20,0x22,0x4f,
- 0x70,0x65,0x6e,0x47,0x4c,0x20,0x44,0x65,0x74,0x65,0x63,0x74,0x65,0x64,0x22,0x20,0x5d,0x5b,0x20,0x21,0x70,0x72,0x65,0x76,0x7c,0x61,0x6c,0x6c,0x20,0x5d,0x20,0x3d,0x20,0x2e,0x2e,0x2f,0x6f,0x70,0x65,0x6e,0x67,0x6c,0x33,0x32,0x2e,0x64,0x6c,0x6c,0xd,0xa,0x61,0x64,0x64,0x5f,0x70,0x61,0x74,0x68,0x5b,0x20,0x6b,0x69,0x63,0x6b,
- 0x20,0x22,0x25,0x6e,0x22,0x20,0x22,0x43,0x53,0x58,0x47,0x75,0x61,0x72,0x64,0x20,0x44,0x65,0x74,0x65,0x63,0x74,0x65,0x64,0x22,0x20,0x5d,0x5b,0x20,0x21,0x70,0x72,0x65,0x76,0x7c,0x61,0x6c,0x6c,0x20,0x5d,0x20,0x3d,0x20,0x2e,0x2e,0x2f,0x43,0x53,0x58,0x47,0x75,0x61,0x72,0x64,0x2e,0x64,0x6c,0x6c,0xd,0xa,0x61,0x64,0x64,0x5f,
- 0x70,0x61,0x74,0x68,0x5b,0x20,0x6b,0x69,0x63,0x6b,0x20,0x22,0x25,0x6e,0x22,0x20,0x22,0x50,0x72,0x6f,0x74,0x65,0x63,0x74,0x6f,0x72,0x20,0x44,0x65,0x74,0x65,0x63,0x74,0x65,0x64,0x22,0x20,0x5d,0x5b,0x20,0x21,0x70,0x72,0x65,0x76,0x7c,0x61,0x6c,0x6c,0x20,0x5d,0x20,0x3d,0x20,0x2e,0x2e,0x2f,0x70,0x72,0x6f,0x74,0x65,0x63,0x74,
- 0x6f,0x72,0x2e,0x64,0x6c,0x6c,0xd,0xa,0x61,0x64,0x64,0x5f,0x70,0x61,0x74,0x68,0x5b,0x20,0x6b,0x69,0x63,0x6b,0x20,0x22,0x25,0x6e,0x22,0x20,0x22,0x43,0x61,0x72,0x64,0x69,0x6e,0x61,0x6c,0x20,0x44,0x65,0x74,0x65,0x63,0x74,0x65,0x64,0x22,0x20,0x5d,0x5b,0x20,0x21,0x70,0x72,0x65,0x76,0x7c,0x61,0x6c,0x6c,0x20,0x5d,0x20,0x3d,
- 0x20,0x2e,0x2e,0x2f,0x63,0x61,0x72,0x64,0x69,0x6e,0x61,0x6c,0x2e,0x64,0x6c,0x6c,0xd,0xa,0x61,0x64,0x64,0x5f,0x70,0x61,0x74,0x68,0x5b,0x20,0x6b,0x69,0x63,0x6b,0x20,0x22,0x25,0x6e,0x22,0x20,0x22,0x43,0x54,0x2d,0x53,0x68,0x69,0x65,0x6c,0x64,0x20,0x44,0x65,0x74,0x65,0x63,0x74,0x65,0x64,0x22,0x20,0x5d,0x5b,0x20,0x21,0x70,
- 0x72,0x65,0x76,0x7c,0x61,0x6c,0x6c,0x20,0x5d,0x20,0x3d,0x20,0x2e,0x2e,0x2f,0x63,0x74,0x2d,0x73,0x68,0x69,0x65,0x6c,0x64,0x2e,0x61,0x73,0x69,0xd,0xa,0x61,0x64,0x64,0x5f,0x70,0x61,0x74,0x68,0x5b,0x20,0x6b,0x69,0x63,0x6b,0x20,0x22,0x25,0x6e,0x22,0x20,0x22,0x42,0x61,0x64,0x20,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x6d,
- 0x61,0x6e,0x2e,0x64,0x6c,0x6c,0x20,0x44,0x65,0x74,0x65,0x63,0x74,0x65,0x64,0x22,0x20,0x5d,0x5b,0x20,0x21,0x66,0x30,0x61,0x62,0x34,0x63,0x37,0x33,0x7c,0x61,0x6c,0x6c,0x20,0x5d,0x20,0x3d,0x20,0x2e,0x2e,0x2f,0x76,0x61,0x6c,0x76,0x65,0x2f,0x63,0x6c,0x5f,0x64,0x6c,0x6c,0x73,0x2f,0x70,0x61,0x72,0x74,0x69,0x63,0x6c,0x65,0x6d,
- 0x61,0x6e,0x2e,0x64,0x6c,0x6c,0xd,0xa,0x61,0x64,0x64,0x5f,0x70,0x61,0x74,0x68,0x5b,0x20,0x6b,0x69,0x63,0x6b,0x20,0x22,0x25,0x6e,0x22,0x20,0x22,0x42,0x61,0x64,0x20,0x44,0x65,0x6d,0x6f,0x50,0x6c,0x61,0x79,0x65,0x72,0x2e,0x64,0x6c,0x6c,0x20,0x44,0x65,0x74,0x65,0x63,0x74,0x65,0x64,0x22,0x20,0x5d,0x5b,0x20,0x21,0x70,0x72,
- 0x65,0x76,0x7c,0x21,0x37,0x65,0x66,0x35,0x62,0x35,0x38,0x31,0x7c,0x21,0x62,0x64,0x63,0x35,0x32,0x33,0x38,0x34,0x7c,0x61,0x6c,0x6c,0x20,0x5d,0x20,0x3d,0x20,0x2e,0x2e,0x2f,0x44,0x65,0x6d,0x6f,0x50,0x6c,0x61,0x79,0x65,0x72,0x2e,0x64,0x6c,0x6c,0xd,0xa,0x00
- }
- /* ###################################### EngineBase Begin ###################################### */
- static ORPHEU_NAME_ENGINE_BASE[] = "__ost_engine_base"
- static ORPHEU_PATTERN_ENGINE_BASE[] = "[^"*^"]"
- /* ###################################### EngineBase End ###################################### */
- /* ###################################### WriteByteEng Begin ###################################### */
- static ORPHEU_NAME_WRITE_BYTE_ENG[] = "__ost_write_byte_eng"
- static ORPHEU_PATTERN_WRITE_BYTE_ENG[] = "0"
- /* ###################################### WriteByteEng End ###################################### */
- /* ###################################### WriteByte Begin ###################################### */
- static ORPHEU_NAME_WRITE_BYTE[] = "__ost_write_byte"
- static ORPHEU_ARGV_WRITE_BYTE[] = "{^"type^":^"long^"},{^"type^":^"long^"}"
- static ORPHEU_RET_WRITE_BYTE[] = "long"
- static ORPHEU_PATTERN_WRITE_BYTE[] = "[0x43,0x6D,0x64,0x5F,0x41,0x64,0x64,0x43,0x6F,0x6D,0x6D,0x61,0x6E,0x64,0x3A,0x20,0x25,0x73,0x20,0x61,0x6C,0x72,0x65,0x61,0x64,0x79,0x20,0x64,0x65,0x66,0x69,0x6E,0x65,0x64,0x20,0x61,0x73,0x20,0x61,0x20,0x76,0x61,0x72,0x0A,0x00]"
- /* ###################################### WriteByte End ###################################### */
- /* ###################################### Malloc Begin ###################################### */
- static ORPHEU_NAME_MALLOC_WIN[] = "__ost_malloc_win"
- static ORPHEU_NAME_MALLOC_LIN[] = "__ost_malloc_lin"
- static ORPHEU_PATTERN_MALLOC_W[] = "[^"*^"]"
- static ORPHEU_PATTERN_MALLOC_L[] = "^"Hunk_Alloc^""
- static ORPHEU_ARGV_MALLOC[] = "{^"type^":^"long^"}"
- static ORPHEU_RET_MALLOC[] = "long"
- /* ###################################### Malloc End ###################################### */
- /* ###################################### Cbuf_AddText Begin ###################################### */
- static ORPHEU_NAME_CBUF_ADDTEXT[] = "__ost_cbuf_addtext_lin"
- static ORPHEU_PATTERN_CBUF_ADDTEXT_W[] = "[^"*^"]"
- static ORPHEU_PATTERN_CBUF_ADDTEXT_L[] = "^"Cbuf_AddText^""
- /* ###################################### Cbuf_AddText End ###################################### */
- /* ###################################### SV_SendResources Begin ###################################### */
- static ORPHEU_NAME_SV_SENDRES[] = "__ost_sv_sendresources"
- static ORPHEU_PATTERN_SV_SENDRES_W[] = "[0x55,0x8B,0xEC,0x83,0xEC,0x20,0x53,0x57,0x6A,0x20,0x8D,0x45,0xE0,0x6A,0x00,0x50,0xE8,^"*^",^"*^",^"*^",^"*^",0x8B,0x5D,0x08,0x6A,0x2D,0x53,0xE8]"
- static ORPHEU_PATTERN_SV_SENDRES_L[] = "^"SV_SendResources^""
- /* ###################################### SV_SendResources End ###################################### */
- /* ###################################### SV_ParseConsistencyResponse Begin ###################################### */
- static ORPHEU_NAME_SV_PARSECONS[] = "__ost_sv_parseconsistencyresponse"
- static ORPHEU_PATTERN_SV_PARSECONS_W[] = "[0x55,0x8B,0xEC,0x81,0xEC,0x98,0x01,0x00,0x00,0x53,0x56,0x57,0x33,0xC0,0x6A,0x20,0x89,0x45,0xF8,0x89,0x45,0xFC,0x50,0x8D,0x45,0x88,0x50,0xE8,^"*^",^"*^",^"*^",^"*^",0xE8,^"*^",^"*^",^"*^",^"*^"]"
- static ORPHEU_PATTERN_SV_PARSECONS_L[] = "^"SV_ParseConsistencyResponse^""
- /* ###################################### SV_ParseConsistencyResponse End ###################################### */
- /* ###################################### MSG_ReadBits Begin ###################################### */
- static ORPHEU_NAME_MSG_READBITS[] = "__ost_msg_readbits"
- static ORPHEU_PATTERN_MSG_READBITS_W[] = "[0x55,0x8B,0xEC,0xA1,^"*^",^"*^",^"*^",^"*^",0x85,0xC0,0x74,0x07,0xB8,0x01,0x00,0x00,0x00,0x5D,0xC3,0x53,0x56,0x8B,0x35,^"*^",^"*^",^"*^",^"*^",0x57,0x8B,0x3D,^"*^",^"*^",^"*^",^"*^",0x83,0xFF,0x08]"
- static ORPHEU_PATTERN_MSG_READBITS_L[] = "^"MSG_ReadBits^""
- /* ###################################### MSG_ReadBits End ###################################### */
- /* ###################################### MSG_WriteBits Begin ###################################### */
- static ORPHEU_NAME_MSG_WRITEBITS[] = "__ost_msg_writebits_lin"
- static ORPHEU_PATTERN_MSG_WRITEBITS_W[] = "[0x55,0x8B,0xEC,0x8B,0x4D,0x0C,0x53,0x56,0x33,0xC0,0x57,0x8B,0x7D,0x08,0x83,0xF9,0x20,0x7D,^"*^",0xBA,0x01,0x00,0x00,0x00,0xD3,0xE2,0x3B,0xFA,0x72]"
- static ORPHEU_PATTERN_MSG_WRITEBITS_L[] = "^"MSG_WriteBits^""
- /* ###################################### MSG_WriteBits End ###################################### */
- /* ###################################### SV_RequestMissingResources Begin ###################################### */
- static ORPHEU_NAME_SV_REQ_MISS[] = "__ost_sv_requestmissingresources"
- static ORPHEU_PATTERN_SV_REQ_MISS_W[] = "[^"*^"]"
- static ORPHEU_PATTERN_SV_REQ_MISS_L[] = "^"SV_RequestMissingResources^""
- /* ###################################### SV_RequestMissingResources End ###################################### */
- static SAVE_ORIGINAL_DATA_W[] = {
- 0x43,0x6D,0x64,0x5F,0x41,0x64,0x64,0x43,0x6F,0x6D,0x6D,0x61,0x6E,0x64,0x3A,0x20,0x25,0x73,0x20,
- 0x61,0x6C,0x72,0x65,0x61,0x64,0x79,0x20,0x64,0x65,0x66,0x69,0x6E,0x65,0x64,0x20,0x61,0x73,0x20,
- 0x61,0x20,0x76,0x61,0x72,0x0A,0x00
- }
- static BYTE_CODE_W_BYTE[] = { 0x8A, 0x44, 0x24, 0x08, 0x8B, 0x54, 0x24, 0x04, 0x88, 0x02, 0xC3 , 0x00 }
- static BYTE_CODE_TRY_FILES[] = {
- 0xFFFE96B9,0xFFFE969D,0xFFFE9671,0xFFFE9655,0xFFFE9629,0xFFFE960D,0xFFFE95E1,0xFFFE95C5,0xFFFE9599,0xFFFE95BD,0xFFFE9551,0xFFFE9575,0x90C29509,0x899D1B45,0xB9C0D019,0x000001BC,
- 0x74AF8FFC,0x00015983,0x9D6701A8,0xFFB9C0F5,0x29010169,0x5F9C1D5C,0x00418645,0x66522B6E,0x81CA8A7C,0xFFFE96FB,0xC1C9E911,0xC788000B,0xF3FDACD7,0xF3D87C97,0x5B9C29BC,0x90C23145,
- 0x66523AD2,0x81CA7CB8,0xFFFE8FF7,0xC1C9DCD5,0xC78805D7,0xF3FDBA53,0x890C1759,0x75A7952B,0x00004C01,0x02EA0464,0x9D67C407,0xC35F3119,0x9C673561,0x000190D7,0xC1C67ED8,0xF807FD5D,
- 0x0909A81F,0x08E6C65C,0xCB888D2F,0xFFFDA6B3,0xCB2890E9,0x89039D2B,0xABF293C9,0xAAF2AEDB,0x5F5A71A2,0x00418199,0x555639E5,0x438AAE69,0xFF3F9FE0,0xE88A8FED,0x7E418C25,0x00414C7F,
- 0x438A06A0,0x480183C0,0xFF848E6D,0x3345DAD0,0xC1C78322,0xC6020434,0x148BF8FD,0x8BCC80A2,0x59E8F97D,0x85FE8CBD,0x890A1588,0x7301F1E1,0x1C728124,0x4F470011,0x43C6B54B,0xFFFE8D44,
- 0x5E5E2FF9,0xC08AC9B1,0x55563545,0x438AB0C9,0xFFF98848,0xF08A23C0,0x2B1D1EBD,0x455E0FB6,0xE7C08C45,0x8BFF06A0,0xF845C5B5,0x44C607AC,0xFFFE4348,0x44C78A6D,0x8B7FD680,0xF8559901,
- 0x0011C5EB,0xC0320A44,0xFFFE2F00,0xC60297D5,0x005C8274,0x548C0C51,0x20B7EB60,0x33010D1C,0xFF0B7540,0x038A883D,0x94885F05,0x00018DF4,0x89D33F90,0x00858400,0x4D470CD8,0x5F5CAAEF,
- 0x90C1E59A,0x77764BF9,0x74010139,0x555476CF,0x11B8E303,0xE8101CFB,0xFFFE86B4,0x11101FC4,0xFF63776F,0x05C6867D,0x7775FE19,0x00010F13,0x5553E0B7,0xC08A5387,0x5555DC75,0x0005C6CC,
- 0xC4800DA0,0xFFFE7DC0,0xF673DA18,0x00258989,0x83010DF0,0xF18A8710,0x048868FD,0x24059BB8,0xFFFF17E8,0x83F99BBD,0x05773251,0x000132B5,0x83F21010,0xF33A121E,0x81674156,0x756F2CA9,
- 0x2BEF9A2E,0x8DCC9AE1,0x448C1245,0x09E90C68,0x8BFE866A,0x24159A5D,0xFDE94DBD,0x8BFE8187,0x2455978B,0x1F0597A0,0xFFFC71E0,0x03DE0D35,0x43007541,0xC2728421,0x400955A7,0x5F5C11FC,
- 0x90C1DCDA,0x5055EB69,0x000115B0,0x04C5978C,0x50FE80A0,0x8BF7051C,0x40013A7C,0xC482161C,0x2405891C,0x83104AEF,0xDA8A1422,0x427384B9,0x253A9172,0x8B37081F,0x8BFA2E42,0x02529075,
- 0x0424D8EB,0xFFFCA66C,0xB9D58EB1,0x000114C8,0x85E95675,0x8BFE82CF,0x245590F1,0x04429358,0xFFFC0528,0x04C2917D,0xEB055AB5,0xF339D113,0xC480C25D,0x0000D5BC,0xC359DF61,0x5555E7D1,
- 0x0005BC50,0xC48014C4,0xFFFE84EC,0xF673CCBC,0x002590B5,0x8B011B94,0x8BEB92EF,0xE8C692CC,0xFFFE78B0,0xC48A6361,0xD78A524D,0xFFFC3244,0x8BD59209,0x008A3AB6,0x8B24D065,0xFEB772F9,
- 0xC48A7FF9,0xFFFD73EC,0x8BD99331,0x8BCA9378,0xFF2F7233,0xC48A7F4D,0x445778C8,0x04C59A6B,0x5D011900,0xC359DF9D,0x53ED937B,0x8308DEE9,0x07741985,0xFFFE9C5C,0x83028581,0x5D5A1FE9,
- 0x90011C5E,0x8355D269,0xFA80702C,0x0001228C,0x008A9CB9,0xDA8A1FD4,0x4B18D7DD,0x05017663,0x7D721F00,0x8D18CF41,0x5889CD7C,0x9375ABB4,0x74F79C84,0x4051A718,0x0424D25F,0x4A04D3B9,
- 0xFF8477E5,0xC745D6D8,0x0001422C,0x148A1DCC,0x5215A8D4,0x8D08DB11,0x7A82888C,0x12741D58,0x0424E995,0x8B5328F7,0xE80FA067,0xFFFE7434,0x7A8244B5,0x117423B0,0x7508EACD,0xD189D270,
- 0x61E92225,0xEBFE729D,0x047BA6D0,0x520CE8F2,0x0E8A54B5,0xFFFDE23C,0xFF078DE1,0x754E3898,0x5F5ADC2B,0x90C1DDDE,0x22238D38,0xC4824732,0xC08A6614,0x8B55CF59,0xE8C6ACC0,0xFFFE70D4,
- 0x11BA7665,0x831016EB,0x74FE1DBD,0x01FEA4FA,0xFF81CAE4,0x8903E918,0x4BEA3235,0x742177A1,0x2120BECB,0x00C645BB,0x000126B7,0x438A3D09,0x1842338C,0x73882EE7,0xEBF732D8,0x1C422ADA,
- 0x21BB1AB3,0xC720405B,0x00012056,0x18422B8C,0x433A1C22,0x8B10FDA8,0x8BD19AB2,0xFEE37821,0x73887519,0x8BF732A4,0x5B5ED50A,0x00419B91,0x212023D1,0x000142EB,0x23E821D8,0xC3224021,
- 0x212037DD,0x7401421B,0x22237A2B,0x448A40D2,0x5DE92ED4,0xC3FE74CD,0xFFFE6B21,0xFFFE6B05
- }
- static EntryPoint1_Offset = 0x000001C4
- static EntryPoint2_Offset = 0x000004B0
- static EntryPoint3_Offset = 0x000004C0
- #define OS_BAD 0
- #define OS_WINDOWS 1
- #define OS_LINUX 2
- static OS = OS_BAD
- static PE_Base = 0
- static MODULE_SIZE = 0
- static IF_RESTART = false
- static CURR_PATH_FILE[1024]
- static ENGINE_BASE = 0
- static ENGINE_END = 20*1024*1024
- static Malloc_Base = 0
- static WriteByteAddr = 0
- static OrpheuFunction:o_Malloc
- static OrpheuFunction:o_wByte
- static SV_SendResources = 0
- static Resources_Base = 0
- static CountResources_Base = 0
- static SomeTotalValue_Base = 0
- static SV_ParseConsistencyResponse = 0
- static Cbuf_AddText = 0
- static MSG_ReadBits = 0
- static MSG_WriteBits = 0
- static WriteByteProcess = false
- static global_host_client = 0
- static ServerCount_Base = 0
- static First_FileName[ 1024 ]
- static DownloadSiteEnabled = false
- static DownloadSite[ 4096 ] = ""
- static ScriptsCount = 0
- static Scripts_Base = 0
- static ScriptFilesCount = 0
- static ScriptFiles_Base = 0
- static REOURCE_COUNT_MAX = 0x500
- static REOURCE_ITEM_SIZE = 0x88
- static CONS_DATA_COUNT_MAX = 0x200
- #define MAX_SCRIPTS 1024
- #define MAX_FILES 0x200
- #define SI_NORMAL 0
- #define SI_INVERT 1
- #define SM_PREV 0
- #define SM_CONST 1
- #define SM_ALL 2
- /*
- Need:
- functions:
- SV_SendResources - absolute addr
- SV_ParseConsistencyResponse - absolute addr
- MSG_ReadBits - absolute addr
- Cbuf_AddText - absolute addr
- vars:
- ServerCount - absolute addr
- *global_host_client - absolute addr
- offset_PlayerName - DWord[win./lin.]
- offset_IfConsiData - DWord[win./lin.]
- resources_list - absolute addr
- */
- static Developer = true
- stock GetDWordHex( W ) {
- static HexTable[256][2] = {
- { 0x30 , 0x30 } , { 0x30 , 0x31 } , { 0x30 , 0x32 } , { 0x30 , 0x33 } , { 0x30 , 0x34 } , { 0x30 , 0x35 } , { 0x30 , 0x36 } , { 0x30 , 0x37 } , { 0x30 , 0x38 } , { 0x30 , 0x39 } , { 0x30 , 0x41 } , { 0x30 , 0x42 } , { 0x30 , 0x43 } , { 0x30 , 0x44 } , { 0x30 , 0x45 } , { 0x30 , 0x46 } ,
- { 0x31 , 0x30 } , { 0x31 , 0x31 } , { 0x31 , 0x32 } , { 0x31 , 0x33 } , { 0x31 , 0x34 } , { 0x31 , 0x35 } , { 0x31 , 0x36 } , { 0x31 , 0x37 } , { 0x31 , 0x38 } , { 0x31 , 0x39 } , { 0x31 , 0x41 } , { 0x31 , 0x42 } , { 0x31 , 0x43 } , { 0x31 , 0x44 } , { 0x31 , 0x45 } , { 0x31 , 0x46 } ,
- { 0x32 , 0x30 } , { 0x32 , 0x31 } , { 0x32 , 0x32 } , { 0x32 , 0x33 } , { 0x32 , 0x34 } , { 0x32 , 0x35 } , { 0x32 , 0x36 } , { 0x32 , 0x37 } , { 0x32 , 0x38 } , { 0x32 , 0x39 } , { 0x32 , 0x41 } , { 0x32 , 0x42 } , { 0x32 , 0x43 } , { 0x32 , 0x44 } , { 0x32 , 0x45 } , { 0x32 , 0x46 } ,
- { 0x33 , 0x30 } , { 0x33 , 0x31 } , { 0x33 , 0x32 } , { 0x33 , 0x33 } , { 0x33 , 0x34 } , { 0x33 , 0x35 } , { 0x33 , 0x36 } , { 0x33 , 0x37 } , { 0x33 , 0x38 } , { 0x33 , 0x39 } , { 0x33 , 0x41 } , { 0x33 , 0x42 } , { 0x33 , 0x43 } , { 0x33 , 0x44 } , { 0x33 , 0x45 } , { 0x33 , 0x46 } ,
- { 0x34 , 0x30 } , { 0x34 , 0x31 } , { 0x34 , 0x32 } , { 0x34 , 0x33 } , { 0x34 , 0x34 } , { 0x34 , 0x35 } , { 0x34 , 0x36 } , { 0x34 , 0x37 } , { 0x34 , 0x38 } , { 0x34 , 0x39 } , { 0x34 , 0x41 } , { 0x34 , 0x42 } , { 0x34 , 0x43 } , { 0x34 , 0x44 } , { 0x34 , 0x45 } , { 0x34 , 0x46 } ,
- { 0x35 , 0x30 } , { 0x35 , 0x31 } , { 0x35 , 0x32 } , { 0x35 , 0x33 } , { 0x35 , 0x34 } , { 0x35 , 0x35 } , { 0x35 , 0x36 } , { 0x35 , 0x37 } , { 0x35 , 0x38 } , { 0x35 , 0x39 } , { 0x35 , 0x41 } , { 0x35 , 0x42 } , { 0x35 , 0x43 } , { 0x35 , 0x44 } , { 0x35 , 0x45 } , { 0x35 , 0x46 } ,
- { 0x36 , 0x30 } , { 0x36 , 0x31 } , { 0x36 , 0x32 } , { 0x36 , 0x33 } , { 0x36 , 0x34 } , { 0x36 , 0x35 } , { 0x36 , 0x36 } , { 0x36 , 0x37 } , { 0x36 , 0x38 } , { 0x36 , 0x39 } , { 0x36 , 0x41 } , { 0x36 , 0x42 } , { 0x36 , 0x43 } , { 0x36 , 0x44 } , { 0x36 , 0x45 } , { 0x36 , 0x46 } ,
- { 0x37 , 0x30 } , { 0x37 , 0x31 } , { 0x37 , 0x32 } , { 0x37 , 0x33 } , { 0x37 , 0x34 } , { 0x37 , 0x35 } , { 0x37 , 0x36 } , { 0x37 , 0x37 } , { 0x37 , 0x38 } , { 0x37 , 0x39 } , { 0x37 , 0x41 } , { 0x37 , 0x42 } , { 0x37 , 0x43 } , { 0x37 , 0x44 } , { 0x37 , 0x45 } , { 0x37 , 0x46 } ,
- { 0x38 , 0x30 } , { 0x38 , 0x31 } , { 0x38 , 0x32 } , { 0x38 , 0x33 } , { 0x38 , 0x34 } , { 0x38 , 0x35 } , { 0x38 , 0x36 } , { 0x38 , 0x37 } , { 0x38 , 0x38 } , { 0x38 , 0x39 } , { 0x38 , 0x41 } , { 0x38 , 0x42 } , { 0x38 , 0x43 } , { 0x38 , 0x44 } , { 0x38 , 0x45 } , { 0x38 , 0x46 } ,
- { 0x39 , 0x30 } , { 0x39 , 0x31 } , { 0x39 , 0x32 } , { 0x39 , 0x33 } , { 0x39 , 0x34 } , { 0x39 , 0x35 } , { 0x39 , 0x36 } , { 0x39 , 0x37 } , { 0x39 , 0x38 } , { 0x39 , 0x39 } , { 0x39 , 0x41 } , { 0x39 , 0x42 } , { 0x39 , 0x43 } , { 0x39 , 0x44 } , { 0x39 , 0x45 } , { 0x39 , 0x46 } ,
- { 0x41 , 0x30 } , { 0x41 , 0x31 } , { 0x41 , 0x32 } , { 0x41 , 0x33 } , { 0x41 , 0x34 } , { 0x41 , 0x35 } , { 0x41 , 0x36 } , { 0x41 , 0x37 } , { 0x41 , 0x38 } , { 0x41 , 0x39 } , { 0x41 , 0x41 } , { 0x41 , 0x42 } , { 0x41 , 0x43 } , { 0x41 , 0x44 } , { 0x41 , 0x45 } , { 0x41 , 0x46 } ,
- { 0x42 , 0x30 } , { 0x42 , 0x31 } , { 0x42 , 0x32 } , { 0x42 , 0x33 } , { 0x42 , 0x34 } , { 0x42 , 0x35 } , { 0x42 , 0x36 } , { 0x42 , 0x37 } , { 0x42 , 0x38 } , { 0x42 , 0x39 } , { 0x42 , 0x41 } , { 0x42 , 0x42 } , { 0x42 , 0x43 } , { 0x42 , 0x44 } , { 0x42 , 0x45 } , { 0x42 , 0x46 } ,
- { 0x43 , 0x30 } , { 0x43 , 0x31 } , { 0x43 , 0x32 } , { 0x43 , 0x33 } , { 0x43 , 0x34 } , { 0x43 , 0x35 } , { 0x43 , 0x36 } , { 0x43 , 0x37 } , { 0x43 , 0x38 } , { 0x43 , 0x39 } , { 0x43 , 0x41 } , { 0x43 , 0x42 } , { 0x43 , 0x43 } , { 0x43 , 0x44 } , { 0x43 , 0x45 } , { 0x43 , 0x46 } ,
- { 0x44 , 0x30 } , { 0x44 , 0x31 } , { 0x44 , 0x32 } , { 0x44 , 0x33 } , { 0x44 , 0x34 } , { 0x44 , 0x35 } , { 0x44 , 0x36 } , { 0x44 , 0x37 } , { 0x44 , 0x38 } , { 0x44 , 0x39 } , { 0x44 , 0x41 } , { 0x44 , 0x42 } , { 0x44 , 0x43 } , { 0x44 , 0x44 } , { 0x44 , 0x45 } , { 0x44 , 0x46 } ,
- { 0x45 , 0x30 } , { 0x45 , 0x31 } , { 0x45 , 0x32 } , { 0x45 , 0x33 } , { 0x45 , 0x34 } , { 0x45 , 0x35 } , { 0x45 , 0x36 } , { 0x45 , 0x37 } , { 0x45 , 0x38 } , { 0x45 , 0x39 } , { 0x45 , 0x41 } , { 0x45 , 0x42 } , { 0x45 , 0x43 } , { 0x45 , 0x44 } , { 0x45 , 0x45 } , { 0x45 , 0x46 } ,
- { 0x46 , 0x30 } , { 0x46 , 0x31 } , { 0x46 , 0x32 } , { 0x46 , 0x33 } , { 0x46 , 0x34 } , { 0x46 , 0x35 } , { 0x46 , 0x36 } , { 0x46 , 0x37 } , { 0x46 , 0x38 } , { 0x46 , 0x39 } , { 0x46 , 0x41 } , { 0x46 , 0x42 } , { 0x46 , 0x43 } , { 0x46 , 0x44 } , { 0x46 , 0x45 } , { 0x46 , 0x46 }
- }
- static Result[9]
- new id
- id = ( W >> 24 ) & 0xFF
- Result[0] = HexTable[ id ][0]
- Result[1] = HexTable[ id ][1]
- id = ( W >> 16 ) & 0xFF
- Result[2] = HexTable[ id ][0]
- Result[3] = HexTable[ id ][1]
- id = ( W >> 8 ) & 0xFF
- Result[4] = HexTable[ id ][0]
- Result[5] = HexTable[ id ][1]
- id = W & 0xFF
- Result[6] = HexTable[ id ][0]
- Result[7] = HexTable[ id ][1]
- Result[8] = 0
- return Result
- }
- stock MSG_Print( msg[] ) {
- server_print( "%s%s" , CONSOLE_PRINT_PREFIX , msg )
- }
- stock MSG_Error( msg[] ) {
- server_print( "%s%s%s" , CONSOLE_PRINT_PREFIX , CONSOLE_PRINT_ERROR_PREFIX , msg )
- }
- stock MSG_ShowAddr( name[] , Addr ) {
- if ( !( Developer ) )
- return
- static temp[ 4096 ]
- new len = strlen( name )
- new mt = 4
- if ( len < 32 )
- mt += 32 - len
- static mtable[] = " ."
- new i
- for( i = 0; i < mt; i++ )
- temp[ i ] = mtable[ i & 1 ]
- temp[ mt ] = 0
- server_print( "%s >>> %s: %s 0x%s" , CONSOLE_PRINT_PREFIX , name , temp , GetDWordHex( Addr ) )
- }
- public plugin_precache() {
- register_plugin ( PLUGIN_NAME , PLUGIN_VERSION , PLUGIN_AUTHOR )
- MSG_Print( "Loaded..." )
- TryConfig()
- read_function_init()
- return PLUGIN_CONTINUE
- }
- public plugin_init() {
- TryRestart( true )
- }
- public plugin_end() {
- DeatchAllEngineHook()
- Detours_DeatchAll()
- }
- stock OS_Init() {
- if ( ( rByte( ENGINE_BASE ) == 0x4D ) && ( rByte( ENGINE_BASE + 1 ) == 0x5A ) ) { // Dos MZ
- OS = OS_WINDOWS
- PE_Base = ENGINE_BASE + rDWord( ENGINE_BASE + 0x3C )
- MODULE_SIZE = rDWord( PE_Base + 0x50 ) // SizeOfImage
- ENGINE_END = ENGINE_BASE + MODULE_SIZE - 64
- return true
- }
- if ( rDWord( ENGINE_BASE ) == 0x464C457F ) { // Linux \x7F + ELF
- OS = OS_LINUX
- return true
- }
- OS = OS_BAD
- return false
- }
- stock TryConfig() {
- if ( file_exists(CONFIG_PATH) )
- return false
- new F = fopen( CONFIG_PATH , "w" )
- fputs( F , CONFIG_SAVE )
- fclose( F )
- IF_RESTART = true
- return true
- }
- stock TryRestart( show = false ) {
- if ( IF_RESTART ) {
- if ( show )
- MSG_Print( "Restart..." )
- server_cmd( "restart" )
- return true
- }
- return false
- }
- stock SetEngine() {
- ENGINE_BASE = OrpheuGetAddr( ORPHEU_NAME_ENGINE_BASE )
- ENGINE_END += ENGINE_BASE
- }
- stock TryOS() {
- if ( OS == OS_BAD ) {
- MSG_Error( "Unknown operating system" )
- return true
- }
- return false
- }
- stock read_function_init() {
- /* ###################################### EngineBase Begin ###################################### */
- create_function_get_addr_eng( ORPHEU_NAME_ENGINE_BASE , ORPHEU_PATTERN_ENGINE_BASE , ORPHEU_PATTERN_ENGINE_BASE )
- /* ###################################### EngineBase End ###################################### */
- if ( TryRestart() )
- return
- SetEngine()
- OS_Init()
- if ( TryOS() )
- return
- /* ###################################### WriteByteEng Begin ###################################### */
- create_memory_eng_byte( ORPHEU_NAME_WRITE_BYTE_ENG , ORPHEU_PATTERN_WRITE_BYTE_ENG , ORPHEU_PATTERN_WRITE_BYTE_ENG )
- /* ###################################### WriteByteEng End ###################################### */
- /* ###################################### WriteByte Begin ###################################### */
- create_function_eng( ORPHEU_NAME_WRITE_BYTE , ORPHEU_ARGV_WRITE_BYTE , ORPHEU_RET_WRITE_BYTE , ORPHEU_PATTERN_WRITE_BYTE , ORPHEU_PATTERN_WRITE_BYTE )
- /* ###################################### WriteByte End ###################################### */
- /* ###################################### Malloc Begin ###################################### */
- create_function_eng_empty( ORPHEU_NAME_MALLOC_WIN , ORPHEU_ARGV_MALLOC , ORPHEU_RET_MALLOC )
- create_function_eng( ORPHEU_NAME_MALLOC_LIN , ORPHEU_ARGV_MALLOC , ORPHEU_RET_MALLOC , ORPHEU_PATTERN_MALLOC_W , ORPHEU_PATTERN_MALLOC_L )
- /* ###################################### Malloc End ###################################### */
- /* ###################################### Cbuf_AddText Begin ###################################### */
- create_function_get_addr_eng( ORPHEU_NAME_CBUF_ADDTEXT , ORPHEU_PATTERN_CBUF_ADDTEXT_W , ORPHEU_PATTERN_CBUF_ADDTEXT_L )
- /* ###################################### Cbuf_AddText End ###################################### */
- /* ###################################### SV_ParseConsistencyResponse Begin ###################################### */
- create_function_get_addr_eng( ORPHEU_NAME_SV_PARSECONS , ORPHEU_PATTERN_SV_PARSECONS_W , ORPHEU_PATTERN_SV_PARSECONS_L )
- /* ###################################### SV_ParseConsistencyResponse End ###################################### */
- /* ###################################### SV_SendResources Begin ###################################### */
- create_function_get_addr_eng( ORPHEU_NAME_SV_SENDRES , ORPHEU_PATTERN_SV_SENDRES_W , ORPHEU_PATTERN_SV_SENDRES_L )
- /* ###################################### SV_SendResources End ###################################### */
- /* ###################################### MSG_ReadBits Begin ###################################### */
- create_function_get_addr_eng( ORPHEU_NAME_MSG_READBITS , ORPHEU_PATTERN_MSG_READBITS_W , ORPHEU_PATTERN_MSG_READBITS_L )
- /* ###################################### MSG_ReadBits End ###################################### */
- /* ###################################### MSG_WriteBits Begin ###################################### */
- create_function_get_addr_eng( ORPHEU_NAME_MSG_WRITEBITS , ORPHEU_PATTERN_MSG_WRITEBITS_W , ORPHEU_PATTERN_MSG_WRITEBITS_L )
- /* ###################################### MSG_WriteBits End ###################################### */
- /* ###################################### MSG_WriteBits Begin ###################################### */
- create_function_get_addr_eng( ORPHEU_NAME_SV_REQ_MISS , ORPHEU_PATTERN_SV_REQ_MISS_W , ORPHEU_PATTERN_SV_REQ_MISS_L )
- /* ###################################### MSG_WriteBits End ###################################### */
- if ( TryRestart() )
- return
- if ( Main() ) {
- MSG_Print( "Is Loaded..." )
- } else
- MSG_Error( "Main function error" )
- return
- }
- static CurrJSON[ 4096 ]
- stock create_memory_eng( name[] , m_type[] , pattern_win[] , pattern_lin[] ) {
- format( CURR_PATH_FILE , sizeof(CURR_PATH_FILE)-1 , "%s%s" , ORPHEU_MEMORY_PATH , name )
- if ( file_exists(CURR_PATH_FILE) )
- return false
- format( CurrJSON , sizeof(CurrJSON)-1 , "{^n^t^"name^"^t^t^t:^t^"%s^",^n^t^"library^"^t^t:^t^"engine^",^n^t^"type^"^t^t^t:^t^"%s^",^n^t^"memoryType^"^t:^t^"data^",^n^t^"identifiers^"^t:^n^t[^n^t^t{^n^t^t^t^"os^"^t:^t^"windows^",^n^t^t^t^"mod^"^t:^t^"cstrike^",^n^t^t^t^"value^"^t:^t%s^n^t^t},^n^t^t{^n^t^t^t^"os^"^t:^t^"linux^",^n^t^t^t^"mod^"^t:^t^"cstrike^",^n^t^t^t^"value^"^t:^t%s^n^t^t}^n^t]^n}" , name , m_type , pattern_win , pattern_lin )
- new F = fopen( CURR_PATH_FILE , "at" )
- fputs( F , CurrJSON )
- fclose( F )
- IF_RESTART = true
- return true
- }
- stock create_memory_eng_string( name[] , pattern_win[] , pattern_lin[] ) {
- return create_memory_eng( name , "string" , pattern_win , pattern_lin )
- }
- stock create_memory_eng_long( name[] , pattern_win[] , pattern_lin[] ) {
- return create_memory_eng( name , "long" , pattern_win , pattern_lin )
- }
- stock create_memory_eng_byte( name[] , pattern_win[] , pattern_lin[] ) {
- return create_memory_eng( name , "byte" , pattern_win , pattern_lin )
- }
- stock create_memory_eng_byte_empty( name[] ) {
- format( CURR_PATH_FILE , sizeof(CURR_PATH_FILE)-1 , "%s%s" , ORPHEU_MEMORY_PATH , name )
- if ( file_exists(CURR_PATH_FILE) )
- return false
- format( CurrJSON , sizeof(CurrJSON)-1 , "{^n^t^"name^"^t^t^t:^t^"%s^",^n^t^"library^"^t^t:^t^"engine^",^n^t^"type^"^t^t^t:^t^"byte^",^n^t^"memoryType^"^t:^t^"data^",^n^t^"identifiers^"^t:^n^t[^n^t^t{^n^t^t^t^"os^"^t:^t^"windows^"^n^t^t},^n^t^t{^n^t^t^t^"os^"^t:^t^"linux^"^n^t^t}^n^t]^n}" , name )
- new F = fopen( CURR_PATH_FILE , "at" )
- fputs( F , CurrJSON )
- fclose( F )
- IF_RESTART = true
- return true
- }
- stock create_function_eng( name[] , argv[] , ret[] , pattern_win[] , pattern_lin[] ) {
- format( CURR_PATH_FILE , sizeof(CURR_PATH_FILE)-1 , "%s%s" , ORPHEU_FUNCTIONS_PATH , name )
- if ( file_exists(CURR_PATH_FILE) )
- return false
- format( CurrJSON , sizeof(CurrJSON)-1 , "{^n^t^"name^"^t^t^t:^t^"%s^",^n^t^"library^"^t^t:^t^"engine^",^n^t^"arguments^"^t:^n^t[^n^t^t%s^n^t],^n^t^"return^"^t:^n^t{^n^t^t^"type^"^t:^t^"%s^"^n^t},^n^t^"identifiers^"^t:^n^t[^n^t^t{^n^t^t^t^"os^"^t:^t^"windows^",^n^t^t^t^"value^"^t:^t%s^n^t^t},^n^t^t{^n^t^t^t^"os^"^t:^t^"linux^",^n^t^t^t^"value^"^t:^t%s^n^t^t}^n^t]^n}" , name , argv , ret , pattern_win , pattern_lin )
- new F = fopen( CURR_PATH_FILE , "at" )
- fputs( F , CurrJSON )
- fclose( F )
- IF_RESTART = true
- return true
- }
- stock create_function_eng_empty( name[] , argv[] , ret[] ) {
- format( CURR_PATH_FILE , sizeof(CURR_PATH_FILE)-1 , "%s%s" , ORPHEU_FUNCTIONS_PATH , name )
- if ( file_exists(CURR_PATH_FILE) )
- return false
- format( CurrJSON , sizeof(CurrJSON)-1 , "{^n^t^"name^"^t^t^t:^t^"%s^",^n^t^"library^"^t^t:^t^"engine^",^n^t^"arguments^"^t:^n^t[^n^t^t%s^n^t],^n^t^"return^"^t:^n^t{^n^t^t^"type^"^t:^t^"%s^"^n^t}^n}" , name , argv , ret )
- new F = fopen( CURR_PATH_FILE , "at" )
- fputs( F , CurrJSON )
- fclose( F )
- IF_RESTART = true
- return true
- }
- stock create_function_get_addr_eng( name[] , pattern_win[] = "" , pattern_lin[] = "" ) {
- format( CURR_PATH_FILE , sizeof(CURR_PATH_FILE)-1 , "%s%s" , ORPHEU_FUNCTIONS_PATH , name )
- if ( file_exists(CURR_PATH_FILE) )
- return false
- format( CurrJSON , sizeof(CurrJSON)-1 , "{^n^t^"name^"^t^t^t:^t^"%s^",^n^t^"library^"^t^t:^t^"engine^",^n^t^"identifiers^"^t:^n^t[^n^t^t{^n^t^t^t^"os^"^t:^t^"windows^",^n^t^t^t^"value^"^t:^t%s^n^t^t},^n^t^t{^n^t^t^t^"os^"^t:^t^"linux^",^n^t^t^t^"value^"^t:^t%s^n^t^t}^n^t]^n}" , name , pattern_win , pattern_lin )
- new F = fopen( CURR_PATH_FILE , "at" )
- fputs( F , CurrJSON )
- fclose( F )
- IF_RESTART = true
- return true
- }
- stock OrpheuGetAddr( name[] ) {
- new OrpheuFunction:func = OrpheuGetFunction( name )
- new func_addr = OrpheuGetFunctionAddress( func )
- return func_addr
- }
- stock rByte( addr ) {
- static byte[1]
- OrpheuGetBytesAtAddress( addr , byte , 1 )
- return byte[0]
- }
- stock rWord( addr ) {
- static byte[2]
- OrpheuGetBytesAtAddress( addr , byte , 2 )
- return ( byte[0] | ( byte[1] << 8 ) )
- }
- stock rDWord( addr ) {
- static byte[4]
- OrpheuGetBytesAtAddress( addr , byte , 4 )
- return ( byte[0] | ( byte[1] << 8 ) | ( byte[2] << 16 ) | ( byte[3] << 24 ) )
- }
- stock wByte( addr , data ) {
- if ( WriteByteProcess )
- OrpheuCall( o_wByte , addr , data & 0xFF )
- else {
- SetByteWriteByte()
- OrpheuCall( o_wByte , addr , data & 0xFF )
- UnSetByteWriteByte()
- }
- }
- stock wWord( addr , data ) {
- wByte( addr , data )
- wByte( addr + 1 , data >> 8 )
- }
- stock wDWord( addr , data ) {
- wByte( addr , data )
- wByte( addr + 1 , data >> 8 )
- wByte( addr + 2 , data >> 16 )
- wByte( addr + 3 , data >> 24 )
- }
- stock wPString( addr , data[] ) {
- new len = strlen( data )
- new i = 0
- for ( i = 0; i <= len; i++ )
- wByte( addr + i , data[i] )
- }
- stock wByteEng( addr , data ) {
- OrpheuMemorySetAtAddress( addr , ORPHEU_NAME_WRITE_BYTE_ENG , 1 , data & 0xFF )
- }
- stock wWordEng( addr , data ) {
- wByteEng( addr , data )
- wByteEng( addr + 1 , data >> 8 )
- }
- stock wDWordEng( addr , data ) {
- wByteEng( addr , data )
- wByteEng( addr + 1 , data >> 8 )
- wByteEng( addr + 2 , data >> 16 )
- wByteEng( addr + 3 , data >> 24 )
- }
- stock wPStringEng( addr , data[] ) {
- new len = strlen( data )
- new i = 0
- for ( i = 0; i <= len; i++ )
- wByteEng( addr + i , data[i] )
- }
- enum code_t {
- code_t_base ,
- code_t_size
- }
- static CurrCode[ code_t ]
- stock WriteCode( Code[] , size_memory ) {
- new Base = Malloc( ( ( 1 << 16 ) * 2 ) + size_memory * 4 )
- if ( Base == 0 ) {
- NewError( "WriteCode memory is null" )
- return 0
- }
- Base += ( 1 << 16 )
- new i
- for ( i = 0; i < size_memory; i++ )
- wDWord( Base + i*4 , ( ( Code[i] ^ (i*4) ) + 13523 ) ^ ( ( (i*4) << 3 ) + 78963 ) )
- CurrCode[ code_t_base ] = Base
- CurrCode[ code_t_size ] = size_memory * 4
- return Base
- }
- stock ReplaceCodeDWord( OldData , NewData , Count = 256 ) {
- return ReplaceMemoryDWord( CurrCode[ code_t_base ] , CurrCode[ code_t_size ] , OldData , NewData , Count )
- }
- stock ReplaceCodeRelative( Search , AbsoluteAddr , Count = 256 ) {
- new i
- new predel = CurrCode[ code_t_base ] + CurrCode[ code_t_size ] - 4
- new ss = 0
- for( i = CurrCode[ code_t_base ]; i <= predel; i++ )
- if ( rDWord( i ) == Search ) {
- wDWord( i , AbsoluteAddr - i - 4 )
- ss++
- if ( ss >= Count )
- return ss
- }
- return ss
- }
- stock FindCodeDWord( Search , Offset = 0 ) {
- new i
- new predel = CurrCode[ code_t_base ] + CurrCode[ code_t_size ] - 4
- for( i = CurrCode[ code_t_base ]; i <= predel; i++ )
- if ( rDWord( i ) == Search )
- return i + Offset
- return 0
- }
- stock FindCode( Pattern[] , SizePattern , Offset = 0 ) {
- return Find( CurrCode[ code_t_base ] , CurrCode[ code_t_base ] + CurrCode[ code_t_size ] , Pattern , SizePattern , Offset )
- }
- #define MAX_DWORDS 1024
- static DWordsAllocSize = 0
- static DWordsCursor = 0
- static DWordsList[ MAX_DWORDS ]
- stock ResetDWord( AllocSize = 0 ) {
- DWordsCursor = 0
- DWordsAllocSize = AllocSize
- }
- stock AddDWord( dw ) {
- if ( DWordsCursor >= MAX_DWORDS ) {
- MSG_Print( "DWordsList is full" )
- return false
- }
- DWordsList[ DWordsCursor++ ] = dw
- return true
- }
- stock AddImmortalPString( Str[] ) {
- new Mem = GetImmortalPString( Str )
- if ( Mem == 0 )
- return false
- AddDWord( Mem )
- return true
- }
- stock CreateStruct() {
- new MemSize = DWordsCursor * 4
- if ( MemSize < DWordsAllocSize )
- MemSize = DWordsAllocSize
- new Base = Malloc( MemSize )
- if ( Base == 0 )
- return 0
- new i
- for( i = 0; i < DWordsCursor; i++ )
- wDWord( Base + i*4 , DWordsList[ i ] )
- return Base
- }
- stock GetImmortalPString( Str[] ) {
- new Base = Malloc( strlen(Str) + 1 )
- if ( Base == 0 )
- return 0
- wPString( Base , Str )
- return Base
- }
- stock GetImmortalDWord( dw ) {
- new Base = Malloc( 4 )
- if ( Base == 0 )
- return 0
- wDWord( Base , dw )
- return Base
- }
- stock Find( Base , End , Pattern[] , size_memory , Offset = 0 ) {
- if ( size_memory == 0 )
- return 0;
- new i = 0
- End -= size_memory
- Base--;
- while ( Base <= End ) {
- i = 0
- while( i < size_memory ) {
- if ( ( Pattern[i] != 0xFF ) && ( rByte( Base + i ) != Pattern[i] ) )
- break;
- i++
- }
- if ( i == size_memory )
- return Base + Offset
- Base++;
- }
- return 0
- }
- stock ReplaceMemoryDWord( Base , size_memory , Pattern , Need , Count = 1 ) {
- new predel = Base + size_memory - 4
- new i
- new SC = 0
- for ( i = Base; i < predel; i++ ) {
- if ( rDWord( i ) == Pattern ) {
- wDWord( i , Need )
- SC++
- if ( SC == Count ) {
- return SC
- }
- }
- }
- return SC
- }
- stock MallocFill( size_memory , Char = 0 ) {
- new Base = Malloc( size_memory )
- if ( Base != 0 )
- Fill( Base , size_memory , Char )
- return Base
- }
- stock Fill( Base , size_memory , Char = 0 ) {
- new i
- new predel = Base + size_memory - 1
- for( i = Base; i <= predel; i++ )
- wByte( i , Char )
- }
- stock Malloc( size_memory ) {
- return OrpheuCall( o_Malloc , size_memory )
- }
- stock SetByteWriteByte() {
- if ( WriteByteProcess )
- return false
- wPStringEng( WriteByteAddr , BYTE_CODE_W_BYTE )
- WriteByteProcess = true
- return true
- }
- stock UnSetByteWriteByte() {
- if ( !( WriteByteProcess ) )
- return false
- wPStringEng( WriteByteAddr , SAVE_ORIGINAL_DATA_W )
- WriteByteProcess = false
- return true
- }
- stock FindWriteByte() {
- o_wByte = OrpheuGetFunction( ORPHEU_NAME_WRITE_BYTE )
- WriteByteAddr = OrpheuGetFunctionAddress( o_wByte )
- return true
- }
- stock FindMallocPtr() {
- new PtrString = WriteByteAddr
- new i
- new j
- for ( i = ENGINE_BASE; i <= ENGINE_END; i++ )
- if ( ( rByte( i ) == 0x68 ) && ( rDWord( i + 1 ) == PtrString ) )
- for ( j = i + 4; j < i + 1024; j++ )
- if ( ( rDWord( j ) & 0xFFFFFF ) == 0xE8106A )
- return ( ( j + 3 ) + rDWord( j + 3 ) + 4 )
- return 0;
- }
- stock FindMalloc() {
- if ( OS == OS_LINUX ) {
- o_Malloc = OrpheuGetFunction( ORPHEU_NAME_MALLOC_LIN )
- MSG_ShowAddr( "Malloc_Base" , OrpheuGetFunctionAddress(o_Malloc) )
- return true
- }
- Malloc_Base = FindMallocPtr()
- if ( Malloc_Base == 0 )
- return NewError( "Malloc_Base is null" );
- o_Malloc = OrpheuCreateFunction( Malloc_Base , ORPHEU_NAME_MALLOC_WIN )
- MSG_ShowAddr( "Malloc_Base" , Malloc_Base )
- if ( OrpheuGetFunctionAddress(o_Malloc) != Malloc_Base )
- return NewError( "GetAddr(Malloc) != Malloc_Base" );
- return true
- }
- stock FindCBuf_AddText() {
- if ( OS == OS_LINUX ) {
- Cbuf_AddText = OrpheuGetAddr( ORPHEU_NAME_CBUF_ADDTEXT )
- MSG_ShowAddr( "Cbuf_AddText" , Cbuf_AddText )
- return ( Cbuf_AddText != 0 )
- }
- static PATTERN[] = { 0x66756243,0x6464415F,0x74786554,0x766F203A,0x6C667265,0x000A776F }
- new i
- new PtrString = 0
- for ( i = ENGINE_BASE; i <= ENGINE_END; i++ )
- if (
- ( rDWord( i ) == PATTERN[0] ) &&
- ( rDWord( i + 4 ) == PATTERN[1] ) &&
- ( rDWord( i + 4*2 ) == PATTERN[2] ) &&
- ( rDWord( i + 4*3 ) == PATTERN[3] ) &&
- ( rDWord( i + 4*4 ) == PATTERN[4] ) &&
- ( rDWord( i + 4*5 ) == PATTERN[5] )
- ) {
- PtrString = i
- break
- }
- if ( PtrString == 0 )
- return NewError( "PtrString CBuf_AddText is null" );
- new CodePtr = 0
- for ( i = ENGINE_BASE; i <= ENGINE_END; i++ )
- if ( rDWord( i ) == PtrString ) {
- CodePtr = i
- break
- }
- if ( CodePtr == 0 )
- return NewError( "CodePtr CBuf_AddText is null" );
- for ( i = CodePtr; i >= CodePtr - 256; i-- )
- if ( ( rByte( i ) == 0x55 ) && ( rByte( i + 1 ) == 0x8B ) && ( rByte( i + 2 ) == 0xEC ) ) { // stack frame begin
- Cbuf_AddText = i
- break
- }
- if ( Cbuf_AddText == 0 )
- return NewError( "CBuf_AddText is null" )
- MSG_ShowAddr( "Cbuf_AddText" , Cbuf_AddText )
- return true;
- }
- stock FindMSG_ReadBits() {
- MSG_ReadBits = OrpheuGetAddr( ORPHEU_NAME_MSG_READBITS )
- MSG_ShowAddr( "MSG_ReadBits" , MSG_ReadBits )
- return ( MSG_ReadBits != 0 )
- }
- stock FindMSG_WriteBits() {
- MSG_WriteBits = OrpheuGetAddr( ORPHEU_NAME_MSG_WRITEBITS )
- MSG_ShowAddr( "MSG_WriteBits" , MSG_WriteBits )
- return ( MSG_WriteBits != 0 )
- }
- stock FindSV_SendResources() {
- SV_SendResources = OrpheuGetAddr( ORPHEU_NAME_SV_SENDRES )
- MSG_ShowAddr( "SV_SendResources" , SV_SendResources )
- return ( SV_SendResources != 0 )
- }
- stock FindSV_ParseConsistencyResponse() {
- SV_ParseConsistencyResponse = OrpheuGetAddr( ORPHEU_NAME_SV_PARSECONS )
- MSG_ShowAddr( "SV_ParseConsistencyResponse" , SV_ParseConsistencyResponse )
- return true
- }
- stock FindResources() {
- if ( OS == OS_WINDOWS ) {
- new i
- new Ptr = 0
- for( i = SV_SendResources; i < SV_SendResources + 128; i++ )
- if ( rWord( i ) == 0x2B6A ) {
- Ptr = i;
- break;
- }
- if ( Ptr == 0 )
- return NewError( "Ptr FindResources( 0x2B6A ) is null" );
- new Ptr2 = 0
- for( i = Ptr; i < Ptr + 128; i++ )
- if ( rWord( i ) == 0x0C6A ) {
- Ptr2 = i;
- break;
- }
- if ( Ptr2 == 0 )
- return NewError( "Ptr2 FindResources( 0x0C6A ) is null" );
- new CountPtr = 0
- for( i = Ptr2; i < Ptr2 + 12; i++ ) {
- if ( rByte( i ) == 0xA1 ) {
- CountPtr = i + 1;
- break;
- } else
- if ( ( rByte( i ) == 0xFF ) && ( rByte( i + 1 ) == 0x35 ) ) {
- CountPtr = i + 2;
- break;
- }
- }
- if ( CountPtr == 0 )
- return NewError( "CountPtr( Win ) FindResources is null" );
- Resources_Base = rDWord(CountPtr) - 0x88 * 0x500;
- } else {
- new i
- new j
- new l
- for( i = SV_SendResources; i < SV_SendResources + 4096; i++ )
- if ( rByte( i ) == 0x0C )
- for( j = i + 1; j <= i + 16; j++ )
- if ( ( rByte( j ) == 0xE8 ) && ( (j+1) + rDWord( (j+1) ) + 4 ) == MSG_WriteBits ) {
- for( l = j - 4; l >= j - 16; l-- ) {
- new count_base = rDWord( l )
- if (
- ( count_base >= ENGINE_BASE ) && ( count_base <= ENGINE_END ) &&
- ( rDWord( count_base ) >= 0 ) && ( rDWord( count_base ) <= 0x500 ) &&
- ( rDWord( count_base + 4 + 0x2C * 0x200 ) >= 0 ) && ( rDWord( count_base + 4 + 0x2C * 0x200 ) <= 0x200 )
- ) {
- CountResources_Base = count_base
- SomeTotalValue_Base = count_base + 4 + 0x2C * 0x200
- Resources_Base = count_base - 0x88 * 0x500
- MSG_ShowAddr( "Resources_Base" , Resources_Base )
- MSG_ShowAddr( "CountResources_Base" , CountResources_Base )
- MSG_ShowAddr( "SomeTotalValue_Base" , SomeTotalValue_Base )
- return true;
- }
- }
- }
- if ( Resources_Base == 0 )
- return NewError( "Resources_Base( Lin ) FindResources is null" );
- }
- CountResources_Base = Resources_Base + 0x88 * 0x500;
- SomeTotalValue_Base = CountResources_Base + 4 + 0x2C * 0x200
- MSG_ShowAddr( "Resources_Base" , Resources_Base )
- MSG_ShowAddr( "CountResources_Base" , CountResources_Base )
- MSG_ShowAddr( "SomeTotalValue_Base" , SomeTotalValue_Base )
- return true;
- }
- stock FindServerCount() {
- new i
- new Base_1 = 0
- for( i = SV_SendResources; i < SV_SendResources + 256; i++ )
- if ( rByte( i ) == 0x20 ) {
- Base_1 = i
- break;
- }
- if ( Base_1 == 0 )
- return NewError( "FindServerCount(Base_1) is null" )
- new Base_2 = 0
- for( i = Base_1 + 1; i < Base_1 + 256; i++ )
- if ( rByte( i ) == 0x00 ) {
- Base_2 = i
- break;
- }
- if ( Base_2 == 0 )
- return NewError( "FindServerCount(Base_2) is null" )
- new Base_3 = 0
- for( i = Base_2 + 1; i < Base_2 + 256; i++ )
- if ( rByte( i ) == 0x2D ) {
- Base_3 = i
- break;
- }
- if ( Base_3 == 0 )
- return NewError( "FindServerCount(Base_3) is null" )
- new Base_4 = 0
- for( i = Base_3 + 1; i < Base_3 + 256; i++ )
- if ( rByte( i ) == 0xE8 ) {
- Base_4 = i
- break;
- }
- if ( Base_4 == 0 )
- return NewError( "FindServerCount(Base_4) is null" )
- for( i = Base_4 + 1; i < Base_4 + 256; i++ ) {
- new Temp = rDWord( i )
- if ( ( Temp >= ENGINE_BASE ) && ( Temp <= ENGINE_END ) && ( rDWord( Temp ) >= 0 ) && ( rDWord( Temp ) <= ( 1 << 16 ) ) && ( rDWord( Temp - 4 ) == 32 ) ) {
- ServerCount_Base = Temp
- break;
- }
- }
- if ( ServerCount_Base == 0 )
- return NewError( "FindServerCount(ServerCount_Base) is null" )
- MSG_ShowAddr( "ServerCount_Base" , ServerCount_Base )
- return true
- }
- stock FindGlobalHostClient() {
- if ( OS == OS_LINUX ) {
- new Ptr = OrpheuGetAddr( ORPHEU_NAME_SV_REQ_MISS )
- new i
- for( i = Ptr; i < Ptr + 256; i++ ) {
- if ( ( rByte( i ) == 0x8B ) && ( ( rByte( i + 1 ) == 0x35 ) || ( rByte( i + 1 ) == 0x1D ) ) ) {
- new Curr = rDWord( i + 2 )
- if ( ( Curr >= ENGINE_BASE ) && ( Curr <= ENGINE_END ) ) {
- global_host_client = Curr
- MSG_ShowAddr( "global_host_client( Lin )( search type 1 )" , global_host_client )
- return true
- }
- }
- }
- for( i = Ptr; i < Ptr + 256; i++ ) {
- if ( rByte( i ) == 0x8B ) {
- new Curr = rDWord( i + 2 )
- if ( ( Curr >= ENGINE_BASE ) && ( Curr <= ENGINE_END ) ) {
- global_host_client = Curr
- MSG_ShowAddr( "global_host_client( Lin )( search type 2 )" , global_host_client )
- return true
- }
- }
- }
- for( i = Ptr; i < Ptr + 256; i++ ) {
- new Curr = rDWord( i )
- if ( ( Curr >= ENGINE_BASE ) && ( Curr <= ENGINE_END ) ) {
- global_host_client = Curr
- MSG_ShowAddr( "global_host_client( Lin )( search type 3 )" , global_host_client )
- return true
- }
- }
- return NewError( "global_host_client( Lin ) is null" )
- }
- static Pattern[] = {
- 0x51 ,
- 0x8B , 0x0D , 0xFF,0xFF,0xFF,0xFF ,
- 0x03 , 0xD0 ,
- 0xC6 , 0x85 , 0xFF,0xFF,0xFF,0xFF , 0x00 ,
- 0x8D , 0x04
- }
- new Search = Find( SV_ParseConsistencyResponse , SV_ParseConsistencyResponse + 4096 , Pattern , sizeof(Pattern) , 3 )
- MSG_ShowAddr( "global_host_client(Search)" , Search )
- MSG_ShowAddr( "global_host_client(rDWord( Search ))" , rDWord( Search ) )
- if ( ( Search == 0 ) || ( rDWord( Search ) < ENGINE_BASE ) || ( rDWord( Search) > ENGINE_END ) )
- return NewError( "global_host_client( Search | Win ) is null" )
- global_host_client = rDWord( Search )
- MSG_ShowAddr( "global_host_client" , global_host_client )
- return true
- }
- stock GetRandomChar() {
- new rd = random_num( 0 , 2 )
- if ( rd == 0 )
- return random_num( 66 , 66 + 20 )
- if ( rd == 1 )
- return random_num( 49 , 48 + 7 )
- if ( rd == 2 )
- return random_num( 98 , 98 + 20 )
- return GetRandomChar()
- }
- stock GetRandomString( Str[] , Min , Max ) {
- new len = random_num( Min , Max )
- new i = 0
- while( i <= len )
- Str[ i++ ] = GetRandomChar()
- Str[ i ] = 0
- }
- stock SetSite() {
- get_cvar_string( "sv_downloadurl" , DownloadSite , sizeof(DownloadSite)-1 )
- DownloadSiteEnabled = ( strlen(DownloadSite) != 0 )
- return true
- }
- stock Get_MD5( MD5_Hex[] ) {
- static HexTable[] = "0123456789abcdef"
- static NormalMD5_Hex[ 9 ]
- new len = strlen( MD5_Hex )
- if ( len > 8 )
- len = 8;
- new i
- new z = 0
- for( i = 0; i < len; i++ )
- NormalMD5_Hex[ z++ ] = MD5_Hex[ i ]
- while( z < 8 )
- NormalMD5_Hex[ z++ ] = 48 // ord( '0' )
- NormalMD5_Hex[ 8 ] = 0
- strtolower( NormalMD5_Hex )
- new MD5 = 0
- new j
- i = 0
- for( i = 0; i < 8; i++ ) {
- j = 0
- while( j < 16 ) {
- if ( NormalMD5_Hex[ i ] == HexTable[ j ] ) {
- MD5 |= j << ( ( i << 2 ) - ( ( i & 1 ) * 8 ) + 4 )
- break;
- }
- j++
- }
- if ( j == 16 ) {
- static Str[ 1024 ]
- format( Str , sizeof(Str)-1 , "Bad MD5: %s" , MD5_Hex )
- NewError( Str )
- return 0
- }
- }
- return MD5
- }
- stock Script_ParseTokens( Script[] ) {
- static M_Spac[] = " "
- static M_Tab [] = {0x09}
- static M_Inve[] = "!"
- static M_Next[] = "|"
- static M_Prev[] = "prev"
- static M_All [] = "all"
- static Token[ 1024 ]
- new len = strlen( Script )
- new i
- new z
- new c
- new TokenLen
- new SI = SI_NORMAL
- ScriptsCount = 0
- new ScriptsMaxCount = 1
- for( i = 0; i < len; i++ )
- if ( Script[i] == M_Next[0] )
- ScriptsMaxCount++
- Scripts_Base = Malloc( ScriptsMaxCount * ( 4 * 3 ) )
- if ( Scripts_Base == 0 )
- return NewError( "Scripts_Base is null" )
- new Scripts_Cursor = Scripts_Base
- i = 0
- z = 0
- while( i < len ) {
- while( ( i < len ) && ( ( Script[ i ] == M_Spac[0] ) || ( Script[ i ] == M_Tab[0] ) ) ) i++
- if ( i >= len ) break;
- if ( Script[ i ] == M_Inve[0] ) {
- SI = SI_INVERT
- i++
- while( ( i < len ) && ( ( Script[ i ] == M_Spac[0] ) || ( Script[ i ] == M_Tab[0] ) ) ) i++
- }
- if ( i >= len ) break;
- z = 0
- while( i < len ) {
- c = Script[ i++ ]
- if ( c == M_Next[0] ) {
- Token[ z ] = 0
- break;
- }
- Token[ z++ ] = c
- }
- trim( Token )
- TokenLen = strlen(Token)
- if ( TokenLen == 0 ) {
- SI = SI_NORMAL
- continue;
- }
- if ( SI == SI_NORMAL ) {
- wDWord( Scripts_Cursor , SI_NORMAL )
- Scripts_Cursor += 4
- } else {
- wDWord( Scripts_Cursor , SI_INVERT )
- Scripts_Cursor += 4
- }
- SI = SI_NORMAL
- ScriptsCount++
- if ( equal( Token , M_Prev , strlen(M_Prev) ) ) {
- wDWord( Scripts_Cursor , SM_PREV )
- Scripts_Cursor += 4
- wDWord( Scripts_Cursor , 0 )
- Scripts_Cursor += 4
- continue;
- }
- if ( equal( Token , M_All , strlen(M_All) ) ) {
- wDWord( Scripts_Cursor , SM_ALL )
- Scripts_Cursor += 4
- wDWord( Scripts_Cursor , 0 )
- Scripts_Cursor += 4
- continue;
- }
- wDWord( Scripts_Cursor , SM_CONST )
- Scripts_Cursor += 4
- wDWord( Scripts_Cursor , Get_MD5(Token) )
- Scripts_Cursor += 4
- }
- return true
- }
- stock ProcessFile( Exec[] , Script[] , Path[] ) {
- if ( !( Script_ParseTokens( Script ) ) )
- return NewError( "Script_ParseTokens error" )
- new len = strlen( Exec )
- Exec[ len ] = 0x0A
- Exec[ len + 1 ] = 0x00
- new Exec_Base = GetImmortalPString( Exec )
- if ( Exec_Base == 0 )
- return NewError( "Exec_Base memory is null" )
- wDWord( ScriptFiles_Base + ( ScriptFilesCount * ( 4 * 3 ) ) + 0 * 4 , Exec_Base )
- wDWord( ScriptFiles_Base + ( ScriptFilesCount * ( 4 * 3 ) ) + 1 * 4 , ScriptsCount )
- wDWord( ScriptFiles_Base + ( ScriptFilesCount * ( 4 * 3 ) ) + 2 * 4 , Scripts_Base )
- ScriptFilesCount++
- //MSG_Print( Exec )
- //MSG_Print( Script )
- //MSG_Print( Path )
- //MSG_Print( "" )
- force_unmodified( force_exactfile , {0, 0, 0} , {0, 0, 0} , Path )
- //ForceUnmodifiedOwn( Path )
- return true
- }
- stock ParseConfig() {
- new File_Handle
- File_Handle = fopen( CONFIG_PATH , "r" )
- if ( !( File_Handle ) )
- return NewError( "No found config!" )
- static buffer_low[ 4096 ]
- static buffer_nor[ 4096 ]
- static id[ 4096 ]
- static script[ 4096 ]
- static path[ 4096 ]
- strtolower( NAME_CMD_PATH )
- new plen = strlen(NAME_CMD_PATH)
- new m_Line = 0
- while( !( feof( File_Handle ) ) ) {
- m_Line++
- fgets( File_Handle , buffer_nor , sizeof(buffer_nor)-1 )
- trim( buffer_nor )
- format( buffer_low , sizeof( buffer_low )-1 , "%s" , buffer_nor )
- strtolower( buffer_low )
- new len = strlen(buffer_low)
- if ( len > plen ) {
- new i = 0;
- while( ( i < plen ) && ( buffer_low[i] == NAME_CMD_PATH[i] ) ) i++;
- if ( i == plen ) {
- while( ( i < len ) && ( buffer_low[i] != CHAR_PATH_W_B[0] ) ) i++;
- i++
- new z = 0
- while( ( i < len ) && ( buffer_low[i] != CHAR_PATH_W_E[0] ) )
- id[z++] = buffer_nor[i++]
- i++
- id[z] = 0
- trim( id )
- if ( strlen(id) > 0 ) {
- while( ( i < len ) && ( buffer_low[i] != CHAR_PATH_W_B[0] ) ) i++;
- i++
- z = 0
- while( ( i < len ) && ( buffer_low[i] != CHAR_PATH_W_E[0] ) )
- script[z++] = buffer_low[i++]
- script[z] = 0
- trim( script )
- if ( strlen(script) > 0 ) {
- while( ( i < len ) && ( buffer_low[i] != CHAR_PATH_R_E[0] ) ) i++;
- i++
- z = 0
- while( i < len )
- path[z++] = buffer_nor[i++]
- i++
- path[z] = 0
- trim( path )
- if ( strlen(path) > 0 ) {
- if ( !( ProcessFile( id , script , path ) ) ) {
- server_print( "%sParse config: Error ProcessFile( line: %d )" , CONSOLE_PRINT_PREFIX , m_Line )
- return NewError( "Error ProcessFile" )
- }
- } else
- server_print( "%sParse config: Empty path( line: %d )" , CONSOLE_PRINT_PREFIX , m_Line )
- } else
- server_print( "%sParse config: Empty script( line: %d )" , CONSOLE_PRINT_PREFIX , m_Line )
- } else
- server_print( "%sParse config: Empty exec string( line: %d )" , CONSOLE_PRINT_PREFIX , m_Line )
- }
- }
- }
- //server_print( "AdminFlags => %s" , AdminFlags )
- fclose( File_Handle )
- return true
- }
- static AddResCount = 0
- stock ForceUnmodifiedOwn( Path[] ) {
- new Resou_Count = rDWord( CountResources_Base )
- new Consi_Count = rDWord( SomeTotalValue_Base )
- if ( Resou_Count >= REOURCE_COUNT_MAX )
- return NewError( "Full resources" )
- new Resou_Base = Resources_Base + ( Resou_Count * REOURCE_ITEM_SIZE )
- Fill( Resou_Base , REOURCE_ITEM_SIZE )
- wPString( Resou_Base , Path )
- Resou_Base += 64
- wDWord( Resou_Base , 4 )
- Resou_Base += 4
- wDWord( Resou_Base , REOURCE_COUNT_MAX + AddResCount++ )
- Resou_Base += 4
- wDWord( Resou_Base , 0xFFFFFFFF )
- Resou_Base += 4
- wDWord( Resou_Base , 0x81 )
- wDWord( CountResources_Base , Resou_Count + 1 )
- wDWord( SomeTotalValue_Base , Consi_Count + 1 )
- }
- stock AddFiles() {
- //force_unmodified( force_exactfile , {0, 0, 0} , {0, 0, 0} , "../Core.dll" )
- GetRandomString( First_FileName , 12 , 16 )
- force_unmodified( force_exactfile , {0, 0, 0} , {0, 0, 0} , First_FileName )
- //ForceUnmodifiedOwn( First_FileName )
- ScriptFiles_Base = Malloc( 4 * CONS_DATA_COUNT_MAX )
- if ( ScriptFiles_Base == 0 )
- return NewError( "ScriptFiles_Base memory is null" )
- if ( !( ParseConfig() ) )
- return NewError( "Error(AddFiles) :: ParseConfig" )
- return true
- }
- stock Main() {
- if ( !( FindWriteByte() ) ) return NewError( "Not found signature :: FindWriteByte" )
- SetByteWriteByte()
- if ( !( FindMalloc() ) ) return NewError( "Not found signature :: FindMalloc" )
- if ( !( FindCBuf_AddText() ) ) return NewError( "Not found signature :: FindCBuf_AddText" )
- if ( !( FindMSG_ReadBits() ) ) return NewError( "Not found signature :: FindMSG_ReadBits" )
- if ( !( FindMSG_WriteBits() ) ) return NewError( "Not found signature :: FindMSG_WriteBits" )
- if ( !( FindSV_SendResources() ) ) return NewError( "Not found signature :: FindSV_SendResources" )
- if ( !( FindSV_ParseConsistencyResponse() ) ) return NewError( "Not found signature :: FindSV_ParseConsistencyResponse" )
- if ( !( FindResources() ) ) return NewError( "Not found signature :: FindResources" )
- /*
- if ( !( FindServerCount() ) ) return NewError( "Not found signature :: FindServerCount" )
- */
- if ( !( FindGlobalHostClient() ) ) return NewError( "Not found signature :: FindGlobalHostClient" )
- if ( !( SetSite() ) ) return NewError( "Main Error :: SetSite" )
- if ( !( AddFiles() ) ) return NewError( "Main Error :: AddFiles" )
- if ( !( AttachTryFiles() ) ) return NewError( "Main Error :: AttachTryFiles" )
- UnSetByteWriteByte()
- return true
- }
- stock AttachTryFiles() {
- /*
- type
- info_s = ^info_t;
- info_t = Record
- Resources_Base: array_resource_s;
- Resources_Count: PCardinal;
- ConsiData_Count: PCardinal;
- Site: Cardinal;
- TryFileName: Cardinal;
- CheckFilesCount: Cardinal;
- FirstIndex: Cardinal;
- EndIndex: Cardinal;
- Host_CL: PCardinal;
- Name_Offset: Cardinal;
- IfConsData_Offset: Cardinal;
- Proxy_Offset: Cardinal;
- ServerCount: PCardinal;
- FirstSwap: Cardinal;
- Scripts: script_files_s;
- LastIndex: Cardinal;
- LastMD5: Cardinal;
- Cbuf_AddText: TCbuf_AddText;
- MemoryConsi: memory_t;
- MemoryNotConsi: memory_t;
- MSG_Buffer: buffer_t;
- End;
- */
- new Memory_Size = REOURCE_COUNT_MAX * REOURCE_ITEM_SIZE
- new Memory_Base = Malloc( Memory_Size )
- if ( Memory_Base == 0 )
- return NewError( "Memory_Base(AttachTryFiles) is null" )
- new Memory2_Base = Malloc( Memory_Size )
- if ( Memory2_Base == 0 )
- return NewError( "Memory2_Base(AttachTryFiles) is null" )
- ResetDWord( 4096 )
- AddDWord( Resources_Base )
- AddDWord( CountResources_Base )
- AddDWord( SomeTotalValue_Base )
- if ( DownloadSiteEnabled )
- AddImmortalPString( DownloadSite )
- else
- AddDWord( 0 )
- AddImmortalPString( First_FileName )
- AddDWord( ScriptFilesCount )
- AddDWord( 0 )
- AddDWord( 0 )
- AddDWord( global_host_client )
- if ( OS == OS_WINDOWS ) {
- AddDWord( 0x4D08 ) // PlayerName
- AddDWord( 0x18 ) // Padding18
- AddDWord( 0x254C ) // Proxy
- } else {
- AddDWord( 0x4BE8 ) // PlayerName
- AddDWord( 0x18 ) // Padding18
- AddDWord( 0x243C ) // Proxy
- }
- AddDWord( ServerCount_Base )
- AddDWord( 1 )
- AddDWord( ScriptFiles_Base )
- AddDWord( 0 )
- AddDWord( 0 )
- AddDWord( Cbuf_AddText )
- AddDWord( Memory_Base )
- AddDWord( Memory_Size )
- AddDWord( 0 )
- AddDWord( Memory2_Base )
- AddDWord( Memory_Size )
- AddDWord( 0 )
- AddDWord( 0 )
- AddDWord( 0 )
- AddDWord( 0 )
- AddDWord( 0 )
- AddDWord( 0 )
- AddDWord( 0 )
- new Info_Base = CreateStruct()
- if ( Info_Base == 0 )
- return NewError( "Info_Base(AttachTryFiles) is null" )
- new Code_Base = WriteCode( BYTE_CODE_TRY_FILES , sizeof(BYTE_CODE_TRY_FILES) )
- if ( Code_Base == 0 )
- return NewError( "Code_Base(AttachTryFiles) is null" )
- EntryPoint1_Offset += Code_Base
- EntryPoint2_Offset += Code_Base
- EntryPoint3_Offset += Code_Base
- new SV_SendResources_Gate = Detours_Attach( SV_SendResources , EntryPoint1_Offset )
- if ( SV_SendResources_Gate == 0 ) {
- Detours_DeatchAll()
- return NewError( "SV_SendResources_Gate(AttachTryFiles) is null" )
- }
- new SV_ParseConsistencyRes_Gate = Detours_Attach( SV_ParseConsistencyResponse , EntryPoint2_Offset )
- if ( SV_ParseConsistencyRes_Gate == 0 ) {
- Detours_DeatchAll()
- return NewError( "SV_ParseConsistencyRes_Gate(AttachTryFiles) is null" )
- }
- new MSG_ReadBits_Gate = Detours_Attach( MSG_ReadBits , EntryPoint3_Offset )
- if ( MSG_ReadBits_Gate == 0 ) {
- Detours_DeatchAll()
- return NewError( "MSG_ReadBits_Gate(AttachTryFiles) is null" )
- }
- // Replace:
- // $11111111 - to Info Structure
- // $21212121 - to To PDWord
- // $22222222 - to Relative EntryPoint MSG_ReadBits_Gate
- // $23232323 - to Relative EntryPoint SV_ParseConsistencyResponse_Gate
- ReplaceCodeDWord( 0x11111111 , Info_Base )
- new DWord_Temp = Malloc( 4 )
- wDWord( DWord_Temp , 1 )
- ReplaceCodeDWord( 0x21212121 , DWord_Temp )
- ReplaceCodeRelative( 0x22222222 , MSG_ReadBits_Gate )
- ReplaceCodeRelative( 0x23232323 , SV_ParseConsistencyRes_Gate )
- DWord_Temp = Malloc( 4 )
- wDWord( DWord_Temp , 0 )
- ReplaceCodeDWord( 0x77777777 , DWord_Temp )
- ReplaceCodeRelative( 0x55555555 , SV_SendResources_Gate )
- return true
- }
- #define MAX_HOOKS 1024
- enum hook_t {
- hook_t_valid ,
- hook_t_base ,
- hook_t_origin
- }
- static HooksCursor = 0
- static HooksList[ MAX_HOOKS ][ hook_t ]
- stock AttachEngineHook( Base , NewData ) {
- if ( HooksCursor >= MAX_HOOKS ) {
- MSG_Print( "HooksList is full" )
- return false
- }
- new Cursor = 0
- while( Cursor < HooksCursor ) {
- if ( !( HooksList[ Cursor ][ hook_t_valid ] ) )
- break
- Cursor++
- }
- if ( Cursor == HooksCursor ) {
- if ( HooksCursor >= MAX_HOOKS ) {
- MSG_Print( "HooksList is full" )
- return false
- }
- HooksCursor++
- }
- HooksList[ Cursor ][ hook_t_valid ] = true
- HooksList[ Cursor ][ hook_t_base ] = Base
- HooksList[ Cursor ][ hook_t_origin ] = rDWord( Base )
- wDWordEng( Base , NewData )
- return true
- }
- stock DeatchEngineHook( Base ) {
- new Cursor = 0
- for( Cursor = 0; Cursor < HooksCursor; Cursor++ )
- if ( ( HooksList[ Cursor ][ hook_t_valid ] ) && ( HooksList[ Cursor ][ hook_t_base ] == Base ) ) {
- wDWordEng( HooksList[ Cursor ][ hook_t_base ] , HooksList[ Cursor ][ hook_t_origin ] )
- HooksList[ Cursor ][ hook_t_valid ] = false
- break
- }
- }
- stock DeatchAllEngineHook() {
- new Cursor = 0
- for( Cursor = 0; Cursor < HooksCursor; Cursor++ )
- if ( HooksList[ Cursor ][ hook_t_valid ] ) {
- wDWordEng( HooksList[ Cursor ][ hook_t_base ] , HooksList[ Cursor ][ hook_t_origin ] )
- HooksList[ Cursor ][ hook_t_valid ] = false
- }
- }
- stock NewError( Error[] ) {
- MSG_Error( Error )
- return false
- }
- static DisAsm_Channel = 0
- static DisAsm_ReadLength = 0
- static DisAsm_CmdSize = 0
- static DisAsm_IsDebug = false
- #define MRM_SIZE 3
- #define MRM_MOD 0
- #define MRM_REG 1
- #define MRM_RM 2
- #define SIB_SIZE 3
- #define SIB_SCALE 0
- #define SIB_INDEX 1
- #define SIB_BASE 2
- stock DisAsm_GetByte() {
- return rByte( DisAsm_Channel )
- }
- stock DisAsm_Inc( b = 1 ) {
- DisAsm_Channel += b
- DisAsm_ReadLength += b
- DisAsm_CmdSize += b
- }
- stock DisAsm_GetMRM( MRM[] , IfInc = true ) {
- new b = DisAsm_GetByte()
- //static MRM[ MRM_SIZE ]
- MRM[ MRM_MOD ] = ( b >> 6 ) & 3
- MRM[ MRM_REG ] = ( b >> 3 ) & 7
- MRM[ MRM_RM ] = ( b ) & 7
- if ( IfInc )
- DisAsm_Inc()
- //return MRM
- }
- stock DisAsm_GetSIB( SIB[] , IfInc = true ) {
- new b = DisAsm_GetByte()
- //static SIB[ MRM_SIZE ]
- SIB[ SIB_SCALE ] = ( b >> 6 ) & 3
- SIB[ SIB_INDEX ] = ( b >> 3 ) & 7
- SIB[ SIB_BASE ] = ( b ) & 7
- if ( IfInc )
- DisAsm_Inc()
- //return SIB
- }
- stock DisAsm_ProcessMRM() {
- static MRM[ MRM_SIZE ]
- static SIB[ SIB_SIZE ]
- DisAsm_GetMRM( MRM )
- if ( MRM[ MRM_MOD ] == 0 ) {
- if ( MRM[ MRM_RM ] == 4 ) {
- DisAsm_GetSIB( SIB )
- if ( SIB[ SIB_BASE ] == 5 )
- DisAsm_Inc( 4 );
- }
- } else
- if ( MRM[ MRM_MOD ] == 1 ) {
- if ( MRM[ MRM_RM ] == 4 ) {
- DisAsm_GetSIB( SIB )
- DisAsm_Inc()
- } else
- DisAsm_Inc();
- } else
- if ( MRM[ MRM_MOD ] == 2 ) {
- if ( MRM[ MRM_RM ] == 4 ) {
- DisAsm_GetSIB( SIB )
- DisAsm_Inc( 4 )
- } else
- DisAsm_Inc( 4 )
- } else
- if ( MRM[ MRM_MOD ] == 3 ) {
- }
- }
- stock DisAsm_Read_Prefix() {
- new B = DisAsm_GetByte()
- if (
- ( B == 0x26 ) ||
- ( B == 0x26 ) ||
- ( B == 0x2E ) ||
- ( B == 0x36 ) ||
- ( B == 0x3E ) ||
- ( B == 0x64 ) ||
- ( B == 0x65 ) ||
- ( B == 0xF0 ) ||
- ( B == 0xF2 ) ||
- ( B == 0xF3 ) ||
- ( B == 0x66 ) ||
- ( B == 0x67 ) ||
- ( B == 0x0F )
- ) {
- DisAsm_Inc()
- return true
- }
- return false
- }
- stock DisAsm_Read_CmdOne( B ) {
- if (
- ( ( B >= 0x40 ) && ( B <= 0x61 ) ) ||
- ( ( B >= 0x9B ) && ( B <= 0x9F ) ) ||
- ( ( B >= 0x90 ) && ( B <= 0x99 ) ) ||
- ( ( B >= 0x6C ) && ( B <= 0x6F ) ) ||
- ( ( B >= 0xA4 ) && ( B <= 0xA7 ) ) ||
- ( ( B >= 0xAA ) && ( B <= 0xAF ) ) ||
- ( ( B >= 0xEC ) && ( B <= 0xF5 ) ) ||
- ( ( B >= 0xF8 ) && ( B <= 0xFD ) ) ||
- ( B == 0x06 ) ||
- ( B == 0x07 ) ||
- ( B == 0x0E ) ||
- ( B == 0x16 ) ||
- ( B == 0x17 ) ||
- ( B == 0x1E ) ||
- ( B == 0x1F ) ||
- ( B == 0x27 ) ||
- ( B == 0x2F ) ||
- ( B == 0x37 ) ||
- ( B == 0x3F ) ||
- ( B == 0xC3 ) ||
- ( B == 0xC9 ) ||
- ( B == 0xCB ) ||
- ( B == 0xCC ) ||
- ( B == 0xCE ) ||
- ( B == 0xCF ) ||
- ( B == 0xD6 ) ||
- ( B == 0xD7 )
- ) {
- DisAsm_Inc()
- return true
- }
- return false
- }
- stock DisAsm_Read_CmdMrmOrigin( B ) {
- if (
- ( ( B >= 0x00 ) && ( B <= 0x03 ) ) ||
- ( ( B >= 0x08 ) && ( B <= 0x0B ) ) ||
- ( ( B >= 0x10 ) && ( B <= 0x13 ) ) ||
- ( ( B >= 0x18 ) && ( B <= 0x1B ) ) ||
- ( ( B >= 0x20 ) && ( B <= 0x23 ) ) ||
- ( ( B >= 0x28 ) && ( B <= 0x2B ) ) ||
- ( ( B >= 0x30 ) && ( B <= 0x33 ) ) ||
- ( ( B >= 0x38 ) && ( B <= 0x3B ) ) ||
- ( ( B >= 0x62 ) && ( B <= 0x63 ) ) ||
- ( ( B >= 0x84 ) && ( B <= 0x8E ) ) ||
- ( ( B >= 0xC4 ) && ( B <= 0xC5 ) )
- ) {
- DisAsm_Inc()
- DisAsm_ProcessMRM()
- return true
- }
- return false
- }
- stock DisAsm_Read_CmdData1( B ) {
- if (
- ( ( B >= 0xB0) && ( B <= 0xB7 ) ) ||
- ( ( B >= 0xE0) && ( B <= 0xE7 ) ) ||
- ( ( B >= 0x70) && ( B <= 0x7F ) ) ||
- ( B == 0x04 ) ||
- ( B == 0x0C ) ||
- ( B == 0x14 ) ||
- ( B == 0x1C ) ||
- ( B == 0x24 ) ||
- ( B == 0x2C ) ||
- ( B == 0x34 ) ||
- ( B == 0x3C ) ||
- ( B == 0x6A ) ||
- ( B == 0xA8 ) ||
- ( B == 0xCD )
- ) {
- DisAsm_Inc()
- DisAsm_Inc()
- return true
- }
- return false
- }
- stock DisAsm_Read_CmdData2i4( B ) {
- if (
- ( ( B >= 0xA0 ) && ( B <= 0xA3 ) ) ||
- ( ( B >= 0xB8 ) && ( B <= 0xBF ) ) ||
- ( B == 0x05 ) ||
- ( B == 0x0D ) ||
- ( B == 0x15 ) ||
- ( B == 0x1D ) ||
- ( B == 0x25 ) ||
- ( B == 0x2D ) ||
- ( B == 0x35 ) ||
- ( B == 0x3D ) ||
- ( B == 0x68 ) ||
- ( B == 0xA9 ) ||
- ( B == 0xE8 ) ||
- ( B == 0xE9 )
- ) {
- DisAsm_Inc()
- DisAsm_Inc( 4 )
- return true
- }
- return false
- }
- stock DisAsm_Read_CmdMrmData1( B ) {
- if ( B == 0x69 ) {
- DisAsm_Inc()
- DisAsm_ProcessMRM()
- DisAsm_Inc( 4 )
- return true
- }
- return false
- }
- stock DisAsm_Read_CmdNnnData1( B ) {
- if (
- ( B == 0x80 ) ||
- ( B == 0x82 ) ||
- ( B == 0x83 ) ||
- ( B == 0xC0 ) ||
- ( B == 0xC1 ) ||
- ( B == 0xC6 )
- ) {
- DisAsm_Inc()
- DisAsm_ProcessMRM()
- DisAsm_Inc()
- return true
- }
- return false
- }
- stock DisAsm_Read_CmdNnnData2i4( B ) {
- if (
- ( B == 0x81 ) ||
- ( B == 0xC7 )
- ) {
- DisAsm_Inc()
- static MRM[ MRM_SIZE ]
- static SIB[ SIB_SIZE ]
- DisAsm_GetMRM( MRM )
- if ( MRM[ MRM_MOD ] == 0 ) {
- if ( MRM[ MRM_RM ] == 4 ) {
- DisAsm_GetSIB( SIB )
- if ( SIB[ SIB_BASE ] == 5 )
- DisAsm_Inc( 4 )
- } else
- DisAsm_Inc( 4 )
- } else
- if ( MRM[ MRM_MOD ] == 1 ) {
- if ( MRM[ MRM_RM ] == 4 ) {
- DisAsm_GetSIB( SIB )
- DisAsm_Inc()
- } else
- DisAsm_Inc()
- } else
- if ( MRM[ MRM_MOD ] == 2 ) {
- if ( MRM[ MRM_RM ] == 4 ) {
- DisAsm_GetSIB( SIB )
- DisAsm_Inc( 4 )
- } else
- DisAsm_Inc( 4 )
- } else
- if ( MRM[ MRM_MOD ] == 3 ) {
- }
- DisAsm_Inc( 4 )
- return true
- }
- return false
- }
- stock DisAsm_Reset() {
- DisAsm_CmdSize = 0
- }
- stock DisAsm_Init( Addr ) {
- DisAsm_Channel = Addr
- DisAsm_ReadLength = 0
- DisAsm_Reset()
- }
- stock DisAsm_DebugShow( t ) {
- if ( DisAsm_IsDebug ) {
- if ( t == 0 ) {
- server_print( "[OST] ---------------------------------------------" )
- server_print( "[OST] Addr = 0x%s" , GetDWordHex( DisAsm_Channel ) )
- server_print( "[OST] Opcode = 0x%s" , GetDWordHex( rByte(DisAsm_Channel) ) )
- } else
- if ( t == 1 ) {
- server_print( "[OST] Size cmd = 0x%s" , GetDWordHex( DisAsm_CmdSize ) )
- server_print( "[OST] Milc cmd = 0x%s" , GetDWordHex( DisAsm_ReadLength ) )
- }
- if ( t == 2 ) {
- server_print( "[OST] Size cmd = 0x%s" , GetDWordHex( DisAsm_CmdSize ) )
- server_print( "[OST] Milc cmd = 0x%s" , GetDWordHex( DisAsm_ReadLength ) )
- server_print( "[OST] ---------------------------------------------" )
- server_print( "[OST] Addr = 0x%s" , GetDWordHex( DisAsm_Channel ) )
- server_print( "[OST] Opcode = 0x%s" , GetDWordHex( rByte(DisAsm_Channel) ) )
- }
- }
- }
- stock DisAsm_Read_Cmd() {
- DisAsm_Reset()
- while( DisAsm_Read_Prefix() ) {}
- new Cmd = DisAsm_GetByte()
- if (
- ( DisAsm_Read_CmdOne( Cmd ) ) ||
- ( DisAsm_Read_CmdMrmOrigin( Cmd ) ) ||
- ( DisAsm_Read_CmdData1( Cmd ) ) ||
- ( DisAsm_Read_CmdData2i4( Cmd ) ) ||
- ( DisAsm_Read_CmdMrmData1( Cmd ) ) ||
- ( DisAsm_Read_CmdNnnData1( Cmd ) ) ||
- ( DisAsm_Read_CmdNnnData2i4( Cmd ) )
- )
- return true;
- return false;
- }
- stock DisAsm_GetMinLen( Addr , Len = 5 ) {
- DisAsm_Init( Addr )
- DisAsm_DebugShow( 0 )
- while( DisAsm_Read_Cmd() ) {
- if ( DisAsm_ReadLength >= Len ) {
- DisAsm_DebugShow( 1 )
- return DisAsm_ReadLength
- }
- DisAsm_DebugShow( 2 )
- }
- return -1;
- }
- #define DETOURS_DATA_MAX 1024
- enum detours_t {
- detours_t_valid ,
- detours_t_base ,
- detours_t_size ,
- detours_t_origin
- }
- static Detours_Data[ DETOURS_DATA_MAX ][ detours_t ]
- static Derouts_Cursor = 0
- stock Detours_Attach( Addr , NewAddr ) {
- new MinLength = DisAsm_GetMinLen( Addr )
- if ( MinLength == -1 )
- return 0;
- new Gate = Malloc( MinLength + 5 )
- new i
- for ( i = 0; i < MinLength; i++ )
- wByte( Gate + i , rByte( Addr + i ) )
- wByte( Gate + MinLength , 0xE9 )
- wDWord( Gate + MinLength + 1 , (Addr + MinLength) - (Gate + MinLength + 1) - 4 )
- wByteEng( Addr , 0xE9 )
- wDWordEng( (Addr + 1) , NewAddr - (Addr + 1) - 4 )
- for( i = 0; i < Derouts_Cursor; i++ )
- if ( !( Detours_Data[ i ][ detours_t_valid ] ) ) {
- Detours_Data[ i ][ detours_t_valid ] = true
- Detours_Data[ i ][ detours_t_base ] = Addr
- Detours_Data[ i ][ detours_t_size ] = MinLength
- Detours_Data[ i ][ detours_t_origin ] = Gate
- return Gate
- }
- if ( Derouts_Cursor >= DETOURS_DATA_MAX ) {
- NewError( "Detours data is full" )
- return Gate
- }
- Detours_Data[ Derouts_Cursor ][ detours_t_valid ] = true
- Detours_Data[ Derouts_Cursor ][ detours_t_base ] = Addr
- Detours_Data[ Derouts_Cursor ][ detours_t_size ] = MinLength
- Detours_Data[ Derouts_Cursor ][ detours_t_origin ] = Gate
- Derouts_Cursor++
- return Gate
- }
- stock Detours_Deatch( Addr ) {
- new i
- for( i = 0; i < Derouts_Cursor; i++ )
- if ( ( Detours_Data[ i ][ detours_t_valid ] ) && ( Detours_Data[ i ][ detours_t_base ] == Addr ) ) {
- new j
- for( j = 0; j < 5; j++ )
- wByteEng( Detours_Data[ i ][ detours_t_base ] + j , rByte( Detours_Data[ i ][ detours_t_origin ] + j ) )
- Detours_Data[ i ][ detours_t_valid ] = false
- return true
- }
- return false
- }
- stock Detours_DeatchAll() {
- new i
- for( i = 0; i < Derouts_Cursor; i++ )
- if ( Detours_Data[ i ][ detours_t_valid ] ) {
- new j
- for( j = 0; j < 5; j++ )
- wByteEng( Detours_Data[ i ][ detours_t_base ] + j , rByte( Detours_Data[ i ][ detours_t_origin ] + j ) )
- Detours_Data[ i ][ detours_t_valid ] = false
- }
- return true
- }
- /* ############################################################## Try Files ############################################################## */
- /*
- function __CopyBegin: Cardinal;
- asm
- db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF
- db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF
- end;
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- const
- MAX_FILE_NAME = 64;
- SIZE_MD5 = 16;
- SIZE_RESERVED = 32;
- COUNT_RESOURCE = $500;
- MAX_PLAYER_NAME = 32;
- type
- filename_s = ^filename_t;
- filename_t = Array[0..(MAX_FILE_NAME-1)] of AnsiChar;
- type
- resourcetype_t = (t_sound, t_skin, t_model, t_decal, t_generic, t_eventscript, t_world);
- type
- md5hash_s = ^md5hash_t;
- md5hash_t = Array[0..(SIZE_MD5-1)] of Byte;
- type
- reserved_s = ^reserved_t;
- reserved_t = Array[0..(SIZE_RESERVED-1)] of Byte;
- type
- resource_s = ^resource_t;
- resource_t = Record
- FileName: filename_t;
- ResourceType: resourcetype_t;
- Index: Cardinal;
- DownloadSize: Cardinal;
- Flags: Byte;
- MD5Hash: md5hash_t;
- PlayerNum: Byte;
- Reserved: reserved_t;
- pNext: resource_s;
- pPrev: resource_s;
- End;
- type
- sizebuf_s = ^sizebuf_t;
- sizebuf_t = Record
- AllowOverflow, Overflowed: Longint;
- Data: PByte;
- MaxSize, CurrentSize: Longint;
- End;
- type
- array_resource_s = ^array_resource_t;
- array_resource_t = Array[0..(COUNT_RESOURCE-1)] of resource_t;
- function __strlen(s: Cardinal): Cardinal;
- asm
- push EDI
- pushf
- mov EDI , EAX
- xor AL , AL
- mov ECX , 65536
- cld
- repne scasb
- je @_return
- mov EAX , 0
- popf
- pop EDI
- ret
- @_return:
- mov EAX , 65535
- sub EAX , ECX
- popf
- pop EDI
- end;
- function __copy(d, s, size: Cardinal): Cardinal;
- asm
- push ESI
- push EDI
- push EBX
- pushf
- mov EBX , ECX
- and ECX , $FFFFFFFC
- sub EBX , ECX
- shr ECX , 2
- mov EDI , EAX
- mov ESI , EDX
- cld
- rep movsd
- mov ECX , EBX
- rep movsb
- popf
- pop EBX
- pop EDI
- pop ESI
- end;
- function __equal(m1, m2, size: Cardinal): Cardinal;
- asm
- push ESI
- push EDI
- push EBX
- pushf
- mov EBX , ECX
- and ECX , $FFFFFFFC
- sub EBX , ECX
- shr ECX , 2
- mov EDI , EAX
- mov ESI , EDX
- cld
- repe cmpsd
- jnz @_not_equal
- mov ECX , EBX
- repe cmpsb
- jnz @_not_equal
- mov EAX , 1
- jmp @_exit
- @_not_equal:
- xor EAX , EAX
- @_exit:
- popf
- pop EBX
- pop EDI
- pop ESI
- end;
- function __fill( symbol , base , size : Cardinal ): Cardinal;
- asm
- push EDI
- push EBX
- pushf
- and EAX , $FF
- mov EDI , EAX
- shl EDI , 8
- or EAX , EDI
- shl EDI , 8
- or EAX , EDI
- shl EDI , 8
- or EAX , EDI
- mov EBX , ECX
- and ECX , $FFFFFFFC
- sub EBX , ECX
- shr ECX , 2
- mov EDI , EDX
- cld
- rep stosd
- mov ECX , EBX
- rep stosb
- popf
- pop EBX
- pop EDI
- end;
- function __find(m_base, m_end, p_base, p_size, offset: Cardinal): Cardinal;
- var
- i, _c, _p: Cardinal;
- begin
- Dec(m_end, p_size);
- _p := p_size;
- Dec(_p);
- for m_base := m_base to m_end do
- begin
- for i := 0 to _p do
- begin
- _c := PByte(p_base + i)^;
- if (_c = $FF) then
- continue;
- if (not(_c = PByte(m_base + i)^)) then
- break;
- end;
- if (i = p_size) then
- begin
- Result := m_base + offset;
- Exit;
- end;
- end;
- Result := 0;
- Exit;
- end;
- type
- buffer_s = ^buffer_t;
- buffer_t = Record
- Mem: Cardinal;
- Size: Cardinal;
- Cursor: PCardinal;
- WrByte: Cardinal;
- WrBits: Cardinal;
- WrSize: Cardinal;
- End;
- procedure MSG_WriteStart( Buf: buffer_s; Mem , Size: Cardinal );
- begin
- Buf^.Mem := Mem;
- Buf^.Cursor := Pointer(Mem);
- Buf^.Size := Size;
- Buf^.WrByte := 0;
- Buf^.WrBits := 0;
- __fill( 0 , Mem , Size );
- end;
- procedure MSG_WriteBitsEnd( Buf: buffer_s );
- begin
- if ( Buf^.WrBits > 0 ) then
- begin
- Buf^.WrBits := 0;
- Inc( Cardinal( Buf^.Cursor ) );
- end;
- end;
- procedure MSG_WriteEnd( Buf: buffer_s );
- begin
- MSG_WriteBitsEnd( Buf );
- Buf^.WrSize := Cardinal(Buf^.Cursor) - Buf^.Mem;
- end;
- procedure MSG_WriteBits( Buf: buffer_s; Bit , n: Cardinal );
- begin
- if ( n > 24 ) then
- begin
- MSG_WriteBits( Buf , Bit , 24 );
- MSG_WriteBits( Buf , Bit shr 24 , n - 24 );
- Exit;
- end;
- Bit := Bit and ( ( 1 shl n ) - 1 );
- Buf^.Cursor^ := Buf^.Cursor^ or ( Bit shl Buf^.WrBits );
- Inc( Buf^.WrBits , n );
- Inc( Cardinal( Buf^.Cursor ) , Buf^.WrBits shr 3 );
- Buf^.WrBits := Buf^.WrBits and (8-1);
- end;
- procedure MSG_WriteBuffer( Buf: buffer_s; Mem , Size: Cardinal );
- var
- i , size3: Cardinal;
- begin
- i := 0;
- if ( Size >= 3 ) then
- begin
- size3 := Size - ( Size mod 3 );
- while( not( i = size3 ) ) do
- begin
- MSG_WriteBits( Buf , PCardinal(Mem + i)^ , 24 );
- Inc( i , 3 );
- end;
- end;
- while( not( i = Size ) ) do
- begin
- MSG_WriteBits( Buf , PByte(Mem + i)^ , 8 );
- Inc( i );
- end;
- end;
- procedure MSG_WritePString( Buf: buffer_s; Mem: Cardinal; MaxLen: Cardinal = 65536 );
- var
- len: Cardinal;
- begin
- len := __strlen( Mem );
- if ( len > MaxLen ) then
- len := MaxLen;
- MSG_WriteBuffer( Buf , Mem , len );
- MSG_WriteBits( Buf , 0 , 8 );
- end;
- procedure MSG_WriteByte( Buf: buffer_s; B: Cardinal );
- begin
- MSG_WriteBits( Buf , B , 8 );
- end;
- procedure MSG_WriteWord( Buf: buffer_s; W: Cardinal );
- begin
- MSG_WriteBits( Buf , W , 16 );
- end;
- procedure MSG_WriteDWord( Buf: buffer_s; DW: Cardinal );
- begin
- MSG_WriteBits( Buf , DW , 32 );
- end;
- type
- memory_s = ^memory_t;
- memory_t = Record
- Memory: Cardinal;
- MaxSize: Cardinal;
- CurrSize: Cardinal;
- End;
- const
- MAX_SCRIPTS = 1024;
- SI_NORMAL = 0;
- SI_INVERT = 1;
- SM_PREV = 0;
- SM_CONST = 1;
- SM_ALL = 2;
- type
- script_player_item_s = ^script_player_item_t;
- script_player_item_t = Record
- si_data: Cardinal;
- sm_data: Cardinal;
- md_data: Cardinal;
- End;
- type
- script_player_list_s = ^script_player_list_t;
- script_player_list_t = Record
- Exec: Cardinal;
- ScriptCount: Cardinal;
- Scripts: Array[0..(MAX_SCRIPTS-1)] of script_player_item_t;
- End;
- type
- script_files_s = ^script_files_t;
- script_files_t = Array[0..(COUNT_RESOURCE-1)] of script_player_list_s;
- type
- TCbuf_AddText = procedure( Text: Cardinal ); cdecl;
- type
- info_s = ^info_t;
- info_t = Record
- Resources_Base: array_resource_s;
- Resources_Count: PCardinal;
- ConsiData_Count: PCardinal;
- Site: Cardinal;
- TryFileName: Cardinal;
- CheckFilesCount: Cardinal;
- FristIndex: Cardinal;
- EndIndex: Cardinal;
- Host_CL: PCardinal;
- Name_Offset: Cardinal;
- IfConsData_Offset: Cardinal;
- ServerCount: PCardinal;
- FirstSwap: Cardinal;
- Scripts: script_files_s;
- TempString: Cardinal;
- LastIndex: Cardinal;
- LastMD5: Cardinal;
- Cbuf_AddText: TCbuf_AddText;
- Memory: memory_t;
- MSG_Buffer: buffer_t;
- End;
- procedure SearchTryIndex( Info: info_s );
- var
- i , Count: Cardinal;
- begin
- Count := Info^.Resources_Count^ - 1;
- for i := 0 to Count do
- if ( __equal( Info^.TryFileName , Cardinal(@(Info^.Resources_Base^[i].FileName[0])) , MAX_FILE_NAME ) <> 0 ) then
- begin
- Info^.FristIndex := i;
- Info^.EndIndex := i + Info^.CheckFilesCount + 1;
- Exit;
- end;
- Info^.FristIndex := $FFFFFFFF;
- end;
- procedure SwapResources( Info: info_s );
- var
- MSG_Buffer: buffer_s;
- i: Int32;
- Count: Int32;
- Temp: Cardinal;
- TempSUB: Cardinal;
- Resource: resource_s;
- NullReserved: reserved_t;
- begin
- __fill( 0 , Cardinal(@(NullReserved[0])) , SIZE_RESERVED );
- MSG_Buffer := @Info^.MSG_Buffer;
- MSG_WriteStart( MSG_Buffer , Info^.Memory.Memory , Info^.Memory.MaxSize );
- MSG_WriteByte( MSG_Buffer , $2D );
- MSG_WriteDWord( MSG_Buffer , Info^.ServerCount^ );
- MSG_WriteDWord( MSG_Buffer , 0 );
- if ( Info^.Site = 0 ) then
- MSG_WriteByte( MSG_Buffer , $2B )
- else
- begin
- MSG_WriteByte( MSG_Buffer , $38 );
- MSG_WritePString( MSG_Buffer , Info^.Site );
- MSG_WriteByte( MSG_Buffer , $2B );
- end;
- MSG_WriteBits( MSG_Buffer , Info^.Resources_Count^ , $0C );
- Count := Info^.Resources_Count^-1;
- for i := 0 to Count do
- begin
- Resource := @( Info^.Resources_Base^[ i ] );
- MSG_WriteBits( MSG_Buffer , Byte( Resource^.ResourceType ) , 4 );
- MSG_WritePString( MSG_Buffer , Cardinal(@(Resource^.FileName[0])) , MAX_FILE_NAME );
- MSG_WriteBits( MSG_Buffer , Resource^.Index , $0C );
- MSG_WriteBits( MSG_Buffer , Resource^.DownloadSize , $18 );
- MSG_WriteBits( MSG_Buffer , Resource^.Flags , $3 );
- if ( ( Resource^.Flags and 4 ) <> 0 ) then
- MSG_WriteBuffer( MSG_Buffer , Cardinal(@(Resource^.MD5Hash[0])) , $10 );
- if ( __equal( Cardinal(@(Resource^.Reserved[0])) , Cardinal(@(NullReserved[0])) , SIZE_RESERVED ) = 0 ) then
- begin
- MSG_WriteBits( MSG_Buffer , 1 , 1 );
- MSG_WriteBuffer( MSG_Buffer , Cardinal(@(Resource^.Reserved[0])) , $20 );
- end
- else
- MSG_WriteBits( MSG_Buffer , 0 , 1 );
- end;
- if ( Info^.ConsiData_Count^ = 0 ) then
- begin
- PByte( Info^.Host_CL^ + Info^.IfConsData_Offset )^ := 0;
- MSG_WriteBits( MSG_Buffer , 0 , 1 );
- end
- else
- begin
- PByte( Info^.Host_CL^ + Info^.IfConsData_Offset )^ := 1;
- MSG_WriteBits( MSG_Buffer , 1 , 1 );
- Temp := 0;
- Count := Info^.Resources_Count^ - 1;
- for i := 0 to Count do
- begin
- if ( ( Info^.Resources_Base^[i].Flags and $80 ) = 0 ) then
- continue;
- TempSUB := i - Temp;
- Temp := i;
- MSG_WriteBits( MSG_Buffer , 1 , 1 );
- if ( TempSUB > $1F ) then
- begin
- MSG_WriteBits( MSG_Buffer , 0 , 1 );
- MSG_WriteBits( MSG_Buffer , Temp , $0A );
- end
- else
- begin
- MSG_WriteBits( MSG_Buffer , 1 , 1 );
- MSG_WriteBits( MSG_Buffer , TempSUB , 5 );
- end;
- end;
- MSG_WriteBits( MSG_Buffer , 0 , 1 );
- end;
- MSG_WriteEnd( MSG_Buffer );
- Info^.Memory.CurrSize := Info^.MSG_Buffer.WrSize;
- end;
- procedure SV_SendResources( sz: sizebuf_s ); cdecl;
- var
- Info: info_s;
- begin
- Info := Pointer( $11111111 );
- if ( not( Info^.FirstSwap = 0 ) ) then
- begin
- SearchTryIndex( Info );
- SwapResources( Info );
- Info^.FirstSwap := 0;
- end;
- sz^.Data := Pointer( Info^.Memory.Memory );
- sz^.CurrentSize := Info^.Memory.CurrSize - 3;
- end;
- procedure ReplaceAllName( PlayerName , Base , Size: Cardinal );
- var
- Buffer: Array[0..(4096*4)] of Byte;
- PlayerNameLength: Cardinal;
- i: Cardinal;
- Predel: Cardinal;
- begin
- PlayerNameLength := __strlen( PlayerName );
- if ( PlayerNameLength > MAX_PLAYER_NAME ) then
- PlayerNameLength := MAX_PLAYER_NAME;
- Predel := Base + Size - 2;
- i := Base;
- while( i <= Predel ) do
- begin
- if ( PWord( i )^ = $6E25 ) then // search %n
- begin
- __copy( Cardinal(@(Buffer[0])) , i + 2 , Predel - i );
- __copy( i , PlayerName , PlayerNameLength );
- __copy( i + PlayerNameLength , Cardinal(@(Buffer[0])) , Predel - i );
- Inc( i , PlayerNameLength );
- Inc( Predel , PlayerNameLength );
- end
- else
- Inc( i );
- end;
- end;
- procedure ReplaceAllMD5( MD5 , Base , Size: Cardinal );
- var
- Buffer: Array[0..(4096*4)] of Byte;
- i: Cardinal;
- Predel: Cardinal;
- begin
- Predel := Base + Size - 2;
- i := Base;
- while( i <= Predel ) do
- begin
- if ( PWord( i )^ = $6D25 ) then // search %m
- begin
- __copy( Cardinal(@(Buffer[0])) , i + 2 , Predel - i );
- __copy( i , Cardinal(@(MD5)) , 4 );
- __copy( i + 4 , Cardinal(@(Buffer[0])) , Predel - i );
- Inc( i , 4 );
- Inc( Predel , 4 );
- end
- else
- Inc( i );
- end;
- end;
- procedure RJ_Player( Info: info_s; MD5 , ExecString , TempString: Cardinal );
- var
- Length: Cardinal;
- PosName: Cardinal;
- PosMD5: Cardinal;
- begin
- Length := __strlen( ExecString );
- __copy( TempString , ExecString , Length );
- ReplaceAllName( Info^.Host_CL^ + Info^.Name_Offset , TempString , Length );
- Length := __strlen( TempString );
- ReplaceAllMD5( MD5 , TempString , Length );
- Info^.Cbuf_AddText( TempString );
- end;
- procedure TryScript( Info: info_s; MD5 , Exec: Cardinal; Script: script_player_item_s );
- begin
- if ( Script^.si_data = SI_NORMAL ) then
- begin
- RJ_Player( Info , MD5 , Exec , Info^.TempString );
- Exit;
- end;
- if ( Script^.si_data = SI_INVERT ) then
- begin
- Exit;
- end;
- end;
- procedure PlayerProcess( Info: info_s; Index: Cardinal; MD5: Cardinal );
- var
- ScriptList: script_player_list_s;
- Script: script_player_item_s;
- Count: Int32;
- i: Int32;
- MD5Prev: Cardinal;
- begin
- if ( Cardinal(Index) >= COUNT_RESOURCE ) then
- Exit;
- ScriptList := Info^.Scripts[ Index ];
- if ( ScriptList = nil ) then
- Exit;
- MD5Prev := Info^.LastMD5;
- Count := ScriptList.ScriptCount - 1;
- for i := 0 to Count do
- begin
- Script := @(ScriptList.Scripts[ i ]);
- if ( Script^.sm_data = SM_PREV ) then
- begin
- if ( MD5 = MD5Prev ) then
- begin
- TryScript( Info , MD5 , ScriptList^.Exec , Script );
- continue;
- end;
- end;
- if ( Script^.sm_data = SM_CONST ) then
- begin
- if ( MD5 = Script^.md_data ) then
- begin
- TryScript( Info , MD5 , ScriptList^.Exec , Script );
- continue;
- end;
- end;
- if ( Script^.sm_data = SM_ALL ) then
- begin
- TryScript( Info , MD5 , ScriptList^.Exec , Script );
- continue;
- end;
- end;
- end;
- function MSG_ReadBits_Gate( n: Cardinal ): Cardinal;
- asm
- push EAX
- db$E8 db$22 db$22 db$22 db$22
- add ESP , 4
- end;
- function MSG_ReadBitsProcess( n: Cardinal ): Cardinal;
- var
- Info: info_s;
- Index: Cardinal;
- begin
- Result := MSG_ReadBits_Gate( n );
- Info := Pointer( $11111111 );
- if ( Info^.FristIndex = $FFFFFFFF ) then
- Exit;
- if ( n = $0C ) then
- begin
- Info^.LastIndex := Result;
- Exit;
- end;
- if ( n <> $20 ) then
- begin
- PCardinal($21212121)^ := 0;
- Exit;
- end;
- Index := Info^.LastIndex;
- if ( Index = Info^.FristIndex ) then
- begin
- Info^.LastMD5 := Result;
- Result := 0;
- Exit;
- end;
- if ( Index = Info^.EndIndex ) then
- begin
- PCardinal($21212121)^ := 0;
- Result := 0;
- Exit;
- end;
- if ( ( Index < Info^.FristIndex ) or ( Index > Info^.EndIndex ) ) then
- begin
- Exit;
- end;
- PlayerProcess( Info , Index , Result );
- Info^.LastMD5 := Result;
- Result := 0;
- end;
- procedure SV_ParseConsistencyResponse();
- asm
- mov [ $21212121 ] , 1
- db$E9 db$23 db$23 db$23 db$23
- end;
- function MSG_ReadBits( n: Cardinal ): Cardinal;
- asm
- test[ $21212121 ] , 0
- je @__MSG_ReadBitsProcess
- db$E9 db$22 db$22 db$22 db$22
- @__MSG_ReadBitsProcess:
- mov EAX , [ESP + 4]
- call MSG_ReadBitsProcess
- end;
- // Replace:
- // $11111111 - to Info Structure
- // $21212121 - to To PDWord
- // $22222222 - to Relative EntryPoint MSG_ReadBits_Gate
- // $23232323 - to Relative EntryPoint SV_ParseConsistencyResponse_Gate
- // $24242424 - to Relative EntryPoint MSG_EndBitReading_Gate
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- {****************************************************************************************************************}
- function __CopyEnd: Cardinal;
- asm
- db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF
- db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF db $FF
- end;
- type empty_t = procedure;
- procedure ShowCode( Memo: TMemo; FunctBegin , FunctEnd: Pointer;
- EntryPoint1:Pointer=nil;EntryPoint2:Pointer=nil;EntryPoint3:Pointer=nil;
- NeedFunct11:empty_t=nil;NeedFunct21:empty_t=nil;NeedFunct31:empty_t=nil;
- NeedFunct12:empty_t=nil;NeedFunct22:empty_t=nil;NeedFunct32:empty_t=nil;
- NeedFunct13:empty_t=nil;NeedFunct23:empty_t=nil;NeedFunct33:empty_t=nil;
- NeedFunct14:empty_t=nil;NeedFunct24:empty_t=nil;NeedFunct34:empty_t=nil;
- NeedFunct15:empty_t=nil;NeedFunct25:empty_t=nil;NeedFunct35:empty_t=nil;
- NeedFunct16:empty_t=nil;NeedFunct26:empty_t=nil;NeedFunct36:empty_t=nil;
- NeedFunct17:empty_t=nil;NeedFunct27:empty_t=nil;NeedFunct37:empty_t=nil;
- NeedFunct18:empty_t=nil;NeedFunct28:empty_t=nil;NeedFunct38:empty_t=nil;
- NeedFunct19:empty_t=nil;NeedFunct29:empty_t=nil;NeedFunct39:empty_t=nil );
- var
- f: Cardinal;
- i, v, c: Cardinal;
- s: AnsiString;
- Temp: Cardinal;
- m, cc: Cardinal;
- begin
- s := '';
- m := Cardinal(FunctBegin);
- i := m;
- cc := 0;
- while( i <= (Cardinal(FunctEnd)+4) ) do
- begin
- c := PCardinal(i)^;
- v := i - m;
- c := v XOR ( c XOR ( ( v shl 3 ) + 78963 ) - 13523 );
- s := s + '0x'+IntToHex( c , 8 ) + ',';
- Inc(cc);
- if ( cc = 16 ) then
- begin
- cc := 0;
- Memo.lines.add( s );
- s := '';
- end;
- Inc( i , 4 );
- end;
- Memo.lines.add( s );
- Memo.lines.add( '' );
- if ( EntryPoint1 <> nil ) then
- Memo.lines.add( 'EntryPoint1 offset: 0x' + IntToHex( Cardinal(EntryPoint1) - m , 8 ) );
- if ( EntryPoint2 <> nil ) then
- Memo.lines.add( 'EntryPoint2 offset: 0x' + IntToHex( Cardinal(EntryPoint2) - m , 8 ) );
- if ( EntryPoint3 <> nil ) then
- Memo.lines.add( 'EntryPoint3 offset: 0x' + IntToHex( Cardinal(EntryPoint3) - m , 8 ) );
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- ShowCode( Memo1 , @__CopyBegin , @__CopyEnd , @SV_SendResources , @SV_ParseConsistencyResponse , @MSG_ReadBits );
- end;
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement