What is the correct conversion types to add to a dll function in quickbms?
unit8_t -- unsigned char?
unit16_t -- ?
unit32_t -- unsigned int?
unit64_t -- ?
calldll
-
- Posts: 250
- Joined: Sat Dec 27, 2014 8:49 pm
Re: calldll
Pretty sure all of the calldll and similar stuff makes use of the 'tcc' (TinyC Compiler) library, so you just need to match what C expects type-wise.
uint8_t - unsigned char
uint16_t - unsigned short
uint32_t - unsigned int
uint64_t - unsigned long long
uint8_t - unsigned char
uint16_t - unsigned short
uint32_t - unsigned int
uint64_t - unsigned long long
-
- Posts: 388
- Joined: Thu Aug 07, 2014 10:28 pm
Re: calldll
Thanks for your help that worked.
Can someone help with converting this function.
I am getting stuck here I think I added the Mersenne-Twister correctly?
its memory file MEMORY_FILE11
Can someone help with converting this function
Code: Select all
void create_decrypt_vector(uint8_t* key, uint8_t* encrypted_data, uint64_t encrypted_size, uint8_t* output, uint64_t output_size)
I am getting stuck here I think I added the Mersenne-Twister correctly?
its memory file MEMORY_FILE11
-
- Posts: 388
- Joined: Thu Aug 07, 2014 10:28 pm
Re: calldll
this might be easier to clean up to help with?
Code: Select all
set MEMORY_FILE11 string "
typedef unsigned char u8;
typedef unsigned int u32;
typedef unsigned long long u64;
#define NN 312
#define MM 156
#define MATRIX_A 0xB5026F5AA96619E9ULL
#define UM 0xFFFFFFFF80000000ULL /* Most significant 33 bits */
#define LM 0x7FFFFFFFULL /* Least significant 31 bits */
struct mt19937_64 {
unsigned long long mt[NN];
unsigned long long mti;
};
void init_genrand64(struct mt19937_64* context, unsigned long long seed)
{
context->mt[0] = seed;
for (context->mti=1; context->mti<NN; context->mti++)
context->mt[context->mti] = (6364136223846793005ULL * (context->mt[context->mti-1] ^ (context->mt[context->mti-1] >> 62)) + context->mti);
}
unsigned long long genrand64_int64(struct mt19937_64* context)
{
unsigned long long i;
unsigned long long j;
unsigned long long result;
if (context->mti >= NN) {/* generate NN words at one time */
unsigned long long mid = NN / 2;
unsigned long long stateMid = context->mt[mid];
unsigned long long x;
unsigned long long y;
for (i = 0, j = mid; i != mid - 1; i++, j++) {
x = (context->mt[i] & UM) | (context->mt[i + 1] & LM);
context->mt[i] = context->mt[i + mid] ^ (x >> 1) ^ ((context->mt[i + 1] & 1) * MATRIX_A);
y = (context->mt[j] & UM) | (context->mt[j + 1] & LM);
context->mt[j] = context->mt[j - mid] ^ (y >> 1) ^ ((context->mt[j + 1] & 1) * MATRIX_A);
}
x = (context->mt[mid - 1] & UM) | (stateMid & LM);
context->mt[mid - 1] = context->mt[NN - 1] ^ (x >> 1) ^ ((stateMid & 1) * MATRIX_A);
y = (context->mt[NN - 1] & UM) | (context->mt[0] & LM);
context->mt[NN - 1] = context->mt[mid - 1] ^ (y >> 1) ^ ((context->mt[0] & 1) * MATRIX_A);
context->mti = 0;
}
result = context->mt[context->mti];
context->mti = context->mti + 1;
result ^= (result >> 29) & 0x5555555555555555ULL;
result ^= (result << 17) & 0x71D67FFFEDA60000ULL;
result ^= (result << 37) & 0xFFF7EEE000000000ULL;
result ^= (result >> 43);
return result;
}
void create_decrypt_vector(u8 *key, u8 *encrypted_data, u64 block_size, u64 encrypted_size, u8 *output, u64 output_size, u64 size) {
u32 v9 = 0;
u64 i;
u64 v12;
for (i = -1; ; i = v12) {
if (v9 >= (int)(encrypted_size >> 3))
break;
//v12 = ((u64*)encrypted_data)[v9] ^ i;
++v9;
}
u64* key_qword = (u64*)key;
u64 seed = key_qword[1] ^ 0x567BA22BABB08098 ^ i ^ key_qword[0];
struct mt19937_64 context;
init_genrand64(&context, seed);
for (u64 i = 0; i < 10 >> 3; i++)
genrand64_int64(&context);
//auto mt_rand = std::mt19937_64(seed);
//for (uint64_t i = 0; i < output_size >> 3; i++)
// ((uint64_t*)output)[i] = mt_rand();
}
"
-
- Posts: 1383
- Joined: Sat Aug 09, 2014 2:34 pm
Re: calldll
My similar script with Mersenne Twister realization > viewtopic.php?t=13086