Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to determine what went wrong during the dependency package distorm installation on Windows 10 host. #41

Open
amlansa opened this issue Sep 7, 2020 · 1 comment

Comments

@amlansa
Copy link

amlansa commented Sep 7, 2020

C:\Users\testaccount\distorm>python setup.py --verbose build
running build
running build_py
not copying python\distorm3_generated.py (output up-to-date)
not copying python\distorm3_init_.py (output up-to-date)
not copying python\distorm3_main_.py (output up-to-date)
running build_ext
Importing new compiler from distutils.msvc9compiler
building '_distorm3' extension
Calling 'vcvarsall.bat x86' (version=9.0)
C:\Users\testaccount\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DSUPPORT_64BIT_OFFSET -DDISTORM_DYNAMIC -Isrc -Iinclude -IC:\Python27\include -IC:\Python27\PC /Tcsrc\decoder.c /Fobuild\temp.win32-2.7\Release\src\decoder.obj
decoder.c
C:\Users\testaccount\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DSUPPORT_64BIT_OFFSET -DDISTORM_DYNAMIC -Isrc -Iinclude -IC:\Python27\include -IC:\Python27\PC /Tcsrc\distorm.c /Fobuild\temp.win32-2.7\Release\src\distorm.obj
distorm.c
src\distorm.c(320) : error C2143: syntax error : missing ';' before 'type'
src\distorm.c(321) : error C2275: '_OffsetType' : illegal use of this type as an expression
c:\users\testaccount\distorm\src../include/distorm.h(110) : see declaration of '_OffsetType'
src\distorm.c(321) : error C2146: syntax error : missing ';' before identifier 'offset'
src\distorm.c(321) : error C2065: 'offset' : undeclared identifier
src\distorm.c(321) : warning C4244: '=' : conversion from 'const _OffsetType' to 'int', possible loss of data
src\distorm.c(345) : error C2065: 'offset' : undeclared identifier
src\distorm.c(346) : error C2065: 'size' : undeclared identifier
error: command '"C:\Users\testaccount\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe"' failed with exit status 2

@smclinden
Copy link

In distorm.c the lines around 320 look like:

                unsigned int opcode = di->opcode;
                unsigned int prefix = FLAG_GET_PREFIX(di->flags);
                mnemonic = (const _WMnemonic*)&_MNEMONICS[opcode]; <--
                unsigned int size = di->size;
                _OffsetType offset = di->addr & addrMask;

Visual C doesn't permit assignments before declarations in some instances. The solution is to move the flagged line to be after all declarations are completed, e.g.,

                unsigned int opcode = di->opcode;
                unsigned int prefix = FLAG_GET_PREFIX(di->flags);
                unsigned int size = di->size;
                mnemonic = (const _WMnemonic*)&_MNEMONICS[opcode]; <--
                _OffsetType offset = di->addr & addrMask;

A similar issue exists in prefix.c, line 141:

        for (unsigned int index = 0;
                (ci->codeLen > 0) && (index < INST_MAXIMUM_SIZE);
                ci->code++, ci->codeLen--, index++) {

Needs to be replaced with:

        unsigned int index;
        for (index = 0;
                (ci->codeLen > 0) && (index < INST_MAXIMUM_SIZE);
                ci->code++, ci->codeLen--, index++) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants