iLuvCoding92 Posted October 3, 2010 Posted October 3, 2010 I am having problems converting this coding form C to Delphi./>http://forum.tuts4you.com/index.php?showtopic=16209&view=findpost&p=81108char* szMemDump = (char*)malloc(mbi.RegionSize+1);malloc is ok. But I don't what's with all the "char*".if( memcmp( (void*)(szMemDump+x), (void*)szBytes, strlen( szBytes ) ) == 0 )I just cannot sum both szMemDump and x together?
kao Posted October 3, 2010 Posted October 3, 2010 1) C is quite strict on variable types, Delphi usually is more relaxed.var szMemDump : pointer;szMemDump := malloc(mbi.RegionSize+1);2) if memcmp(pointer(dword(szMemDump)+x), szBytes, strlen(szBytes)) = 0 thenAnyway, I would suggest that you do not convert the code literally, instead think what the C code does and write new code using Delphi functions (eg. GetMem instead on malloc, CompareMem instead of memcmp, Length instead of strlen).
0xFF Posted October 9, 2010 Posted October 9, 2010 There's no such thing as malloc in delphi, use GetMem().
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now