I found a way of calling assembly directly from DXL, which means, that any windows API function can be called directly from DXL. This could be the breakthrough for calling external DLL libraries directly from DXL! Nice ...
string s = ""
int *BufferData (Buffer x) {
int *ptr = addr_ (((addr_ x) int) + 8)
int ad = *ptr;
int *ptr2 = addr_ ad
return ptr2
}
int *BufferLength (Buffer x) {
int *ptr = addr_ (((addr_ x) int) + 12)
return ptr
}
int *::+(int *ptr, int val) {
int *result = ptr
result += val;
return result
}
void setByte (int *ptr, int byte) {
int ptrVal = *ptr
int val = ( ptrVal - (ptrVal & 255) ) + ((byte & 255) )
*ptr = val
}
int code[] = {0xe8,0x00,0x00,0x00,0x00,0x89,0xd8,0x5b,0x56,0x50,0x8d,0xb3,0x20,0x01,0x00,0x00,0x56,
0x8d,0xb3,0x1c,0x01,0x00,0x00,0x56,0x6a,0x01,0x68,0x88,0x8f,0x03,0x00,0xe8,0x1c,0x00,
0x00,0x00,0x6a,0x00,0x8d,0x83,0x28,0x01,0x00,0x00,0x50,0x50,0x6a,0x00,0xff,0x93,0x20,
0x01,0x00,0x00,0x8b,0x83,0x24,0x01,0x00,0x00,0x5b,0x5e,0x50,0xc3,0x55,0x89,0xe5,0x51,
0x56,0x57,0x8b,0x4d,0x0c,0x8b,0x75,0x10,0x8b,0x7d,0x14,0xff,0x36,0xff,0x75,0x08,0xe8,
0x13,0x00,0x00,0x00,0x89,0x07,0x83,0xc7,0x04,0x83,0xc6,0x04,0xe2,0xec,0x5f,0x5e,0x59,
0x89,0xec,0x5d,0xc2,0x10,0x00,0x55,0x89,0xe5,0x53,0x56,0x57,0x51,0x64,0xff,0x35,0x30,
0x00,0x00,0x00,0x58,0x8b,0x40,0x0c,0x8b,0x48,0x0c,0x8b,0x11,0x8b,0x41,0x30,0x6a,0x02,
0x8b,0x7d,0x08,0x57,0x50,0xe8,0x5b,0x00,0x00,0x00,0x85,0xc0,0x74,0x04,0x89,0xd1,0xeb,
0xe7,0x8b,0x41,0x18,0x50,0x8b,0x58,0x3c,0x01,0xd8,0x8b,0x58,0x78,0x58,0x50,0x01,0xc3,
0x8b,0x4b,0x1c,0x8b,0x53,0x20,0x8b,0x5b,0x24,0x01,0xc1,0x01,0xc2,0x01,0xc3,0x8b,0x32,
0x58,0x50,0x01,0xc6,0x6a,0x01,0xff,0x75,0x0c,0x56,0xe8,0x23,0x00,0x00,0x00,0x85,0xc0,
0x74,0x08,0x83,0xc2,0x04,0x83,0xc3,0x02,0xeb,0xe3,0x58,0x31,0xd2,0x66,0x8b,0x13,0xc1,
0xe2,0x02,0x01,0xd1,0x03,0x01,0x59,0x5f,0x5e,0x5b,0x89,0xec,0x5d,0xc2,0x08,0x00,0x55,
0x89,0xe5,0x51,0x53,0x52,0x31,0xc9,0x31,0xdb,0x31,0xd2,0x8b,0x45,0x08,0x8a,0x10,0x80,
0xca,0x60,0x01,0xd3,0xd1,0xe3,0x03,0x45,0x10,0x8a,0x08,0x84,0xc9,0xe0,0xee,0x31,0xc0,
0x8b,0x4d,0x0c,0x39,0xcb,0x74,0x01,0x40,0x5a,0x5b,0x59,0x89,0xec,0x5d,0xc2,0x0c,0x00,
0x1a,0xb8,0x06,0x00,0x00,0x00,0x00,0x00,0x04,0x03,0x02,0x01,0x48,0x65,0x6c,0x6c,0x6f,
0x20,0x66,0x72,0x6f,0x6d,0x20,0x69,0x6e,0x6a,0x65,0x63,0x74,0x65,0x64,0x20,0x73,0x68,
0x65,0x6c,0x6c,0x63,0x6f,0x64,0x65,0x21,0x00}
Buffer b = create(sizeof code+10)
*(BufferLength b) = sizeof code
int i; for i in 0:(sizeof code)-1 do setByte((BufferData b) + i, code[i] )
int *data = BufferData b
Skip sk = createString()
put (sk, s, 0)
int *ptr = addr_ sk
ptr += 4
int oldVal = *ptr
*(data+((sizeof code) - 35)) = oldVal
*ptr = (addr_ data) int
put (sk, s, 0)
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Mathias Mamsch - Sat Oct 23 18:40:17 EDT 2010 |