Originally posted by bootcoder So exactly like on other models.Don't think so.Test and try.Using mingw gcc 3.4.5 for windows:
Code:
gcc -std=c99 ptxfwtool.c -o ptxfwtool.exe
That's it.
what i meant was it did compile but it does not execute, frmcrypt the version presently available executes but output is irrelevant
---------- Post added 01-05-2015 at 07:18 AM ----------
Originally posted by bootcoder So exactly like on other models.Don't think so.Test and try.Using mingw gcc 3.4.5 for windows:
Code:
gcc -std=c99 ptxfwtool.c -o ptxfwtool.exe
That's it.
#include <stdio.h>
#include <stdlib.h>
void decrypt(void *this, int mode, void *fileBufferPtr);
int main()
{
FILE *fp;
FILE *pFile;
int counter;
fp = fopen("in.bin", "rb");
if (fp == NULL) {
printf("I couldn't open results.dat for writing.\n");
exit(0);
}
fseek(fp, 0L, SEEK_END);
size_t sz = ftell(fp);
fseek(fp, 0L, SEEK_SET);
int* buffer = (int*) malloc(sz);
fread(buffer, sz, 1, fp);
fclose(fp);
for (counter = 0; counter < (sz / sizeof(int)); counter++)
{
// change the byte order
int num = *(buffer + counter);
int swapped = ((num>>24)&0xff) | // move byte 3 to byte 0
((num<<8)&0xff0000) | // move byte 1 to byte 2
((num>>8)&0xff00) | // move byte 2 to byte 1
((num<<24)&0xff000000); // byte 0 to byte 3
*(buffer + counter) = swapped;
}
decrypt(NULL, 0, buffer);
decrypt(NULL, 1, buffer);
// now change the endian-ness again
for (counter = 0; counter < (sz / sizeof(int)); counter++)
{
// change the byte order
int num = *(buffer + counter);
int swapped = ((num>>24)&0xff) | // move byte 3 to byte 0
((num<<8)&0xff0000) | // move byte 1 to byte 2
((num>>8)&0xff00) | // move byte 2 to byte 1
((num<<24)&0xff000000); // byte 0 to byte 3
*(buffer + counter) = swapped;
}
/* Write your buffer to disk. */
pFile = fopen("out.bin","wb");
if (pFile)
{
fwrite(buffer, sz, 1, pFile);
}
else
{
puts("Something wrong writing to File.");
}
fclose(pFile);
return 0;
}
lets see which compilier accepts this
---------- Post added 01-05-2015 at 07:20 AM ----------
int swapped = ((num>>24)&0xff) | // move byte 3 to byte 0
((num<<8)&0xff0000) | // move byte 1 to byte 2
((num>>8)&0xff00) | // move byte 2 to byte 1
((num<<24)&0xff000000); // byte 0 to byte 3
this is repeated for endian-ness
decrypt!!!
encrypt!!!
Read more at:
https://www.pentaxforums.com/forums/6-pentax-dslr-discussion/250555-resurrect...#ixzz3NuKi2l4i