babasuck / dllToLib

Util to convert dll to lib
2 stars 1 forks source link

Cant run the tool #1

Open greenozon opened 9 months ago

greenozon commented 9 months ago

Could you hint me what am I doing wrong? smth strange is going on...

my try:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

c:\Tmp>python main.py
Select parameters correctly:
1 - path to Dll
2 - path to save .lib
3 - path to save .inc

c:\Tmp>lib
'lib' is not recognized as an internal or external command,
operable program or batch file.

c:\Tmp>dumpbin
'dumpbin' is not recognized as an internal or external command,
operable program or batch file.

c:\Tmp>c:\Dev\VS2019\VC\Auxiliary\Build\vcvars32.bat
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.32
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'

c:\Tmp>lib
Microsoft (R) Library Manager Version 14.29.30153.0
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: LIB [options] [files]

   options:

      /DEF[:filename]
      /ERRORREPORT:{NONE|PROMPT|QUEUE|SEND}
      /EXPORT:symbol
      /EXTRACT:membername
      /INCLUDE:symbol
      /LIBPATH:dir
      /LINKREPRO:dir
      /LINKREPROTARGET:filename
      /LIST[:filename]
      /LTCG
      /MACHINE:{ARM|ARM64|ARM64EC|EBC|X64|X86}
      /NAME:filename
      /NODEFAULTLIB[:library]
      /NOLOGO
      /OUT:filename
      /REMOVE:membername
      /SUBSYSTEM:{BOOT_APPLICATION|CONSOLE|EFI_APPLICATION|
                  EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|
                  NATIVE|POSIX|WINDOWS|WINDOWSCE}[,#[.##]]
      /VERBOSE
      /WX[:NO]

c:\Tmp>dumpbin
Microsoft (R) COFF/PE Dumper Version 14.29.30153.0
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: DUMPBIN [options] [files]

   options:

      /ALL
      /ARCHIVEMEMBERS
      /CLRHEADER
      /DEPENDENTS
      /DIRECTIVES
      /DISASM[:{BYTES|NOBYTES}]
      /ERRORREPORT:{NONE|PROMPT|QUEUE|SEND}
      /EXPORTS
      /FPO
      /HEADERS
      /IMPORTS[:filename]
      /LINENUMBERS
      /LINKERMEMBER[:{1|2|4|8|16|32}]
      /LOADCONFIG
      /NOLOGO
      /NOPDB
      /OUT:filename
      /PDATA
      /PDBPATH[:VERBOSE]
      /RANGE:vaMin[,vaMax]
      /RAWDATA[:{NONE|1|2|4|8}[,#]]
      /RELOCATIONS
      /SECTION:name
      /SUMMARY
      /SYMBOLS
      /TLS
      /UNWINDINFO

c:\Tmp>python main.py C:\Windows\System32  lib inc
lib\
inc\
inc\aaclient.inc
The system cannot find the path specified.
Make sure set path to dumpbin.exe to PATH variable.

c:\Tmp>

c:\Tmp>python -V
Python 3.12.0
babasuck commented 9 months ago

Firstly you need to activate virtual env For example: C:\dlllib\venv\Scripts\activate

After this you can use script: C:\dlllib(venv) python main.py C:\Windows\System32 C:\masm64\lib C:\masm64\inc (you need to pass a full path)

babasuck commented 9 months ago

and do this in Visual Studio 2019 Developer Command Prompt

greenozon commented 9 months ago

I'm not sure if venv is the missing part here, anyway I gave it a try, same result (also used abs paths instead of relative ones):


(venv) c:\Tmp>python main.py C:\Windows\System32  c:\tmp\lib\ c:\tmp\inc\
c:\tmp\lib\\
c:\tmp\inc\\
c:\tmp\inc\\aaclient.inc
The system cannot find the path specified.
Make sure set path to dumpbin.exe to PATH variable.

at the same time if I execute dumpbin and lib inside venv -they are resolved and showing help...

is it smth related to Python 3.12 or... ?

xverizex commented 6 months ago

@greenozon If you did not fix it, then try to set full path to dumpbin in python script.

greenozon commented 6 months ago

which one should I take? image

babasuck commented 6 months ago

@greenozon use x64 one

greenozon commented 6 months ago

:( same error.... WTF :)

xverizex commented 6 months ago

@greenozon I hope you write a correct path. Show how you text it.

greenozon commented 6 months ago

Here we go:

tool itself runs (even having Linux slashes)

c:\Tmp>c:/Dev/VS2019/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/dumpbin.exe
Microsoft (R) COFF/PE Dumper Version 14.29.30154.0
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: DUMPBIN [options] [files]

   options:

      /ALL
      /ARCHIVEMEMBERS
      /CLRHEADER
      /DEPENDENTS
      /DIRECTIVES
      /DISASM[:{BYTES|NOBYTES}]
      /ERRORREPORT:{NONE|PROMPT|QUEUE|SEND}
      /EXPORTS
      /FPO
      /HEADERS
      /IMPORTS[:filename]
      /LINENUMBERS
      /LINKERMEMBER[:{1|2|4|8|16|32}]
      /LOADCONFIG
      /NOLOGO
      /NOPDB
      /OUT:filename
      /PDATA
      /PDBPATH[:VERBOSE]
      /RANGE:vaMin[,vaMax]
      /RAWDATA[:{NONE|1|2|4|8}[,#]]
      /RELOCATIONS
      /SECTION:name
      /SUMMARY
      /SYMBOLS
      /TLS
      /UNWINDINFO

here is the change in the code:

image

image

xverizex commented 6 months ago

@greenozon ok. You should read this https://www.computerhope.com/issues/ch000549.htm

You should to set path to vs execute directory where are store programs.exe.

greenozon commented 6 months ago

Is it still required even I ran the c:\Dev\VS2019\VC\Auxiliary\Build\vcvars64.bat script before?

look - dumpbin exe itself is searchable - I could freely run it.. the issue comes when python tries to run it... smth is wrong over there...

image

babasuck commented 6 months ago

@greenozon please give me some time to add in code more verbose error message

babasuck commented 6 months ago

also make sure to create inc and lib folders before runing the tool

babasuck commented 6 months ago

@greenozon Hello, please give it a try now! Also check my usage video: https://youtu.be/ybqSsimLz6U

greenozon commented 6 months ago

Thanks for video feeback! I gave it a try as in your vid and you know what? it worked!

the new question is why do I hit one fail without any errors about it>.... image

babasuck commented 6 months ago

Honestly, I dunno:) some dlls just doesn't work!

greenozon commented 6 months ago

It's OK, but lets print out at least error code and/or error text that utility is producing?...

xverizex commented 5 months ago

@babasuck so, some weeks ago I merged request which solves the issue

greenozon commented 5 months ago

any details on merged stuff?

xverizex commented 5 months ago

@greenozon see pull request.

greenozon commented 5 months ago

yeah, silly me, thanks a lot! will have some nice time after fresh cupofcoffee :)

greenozon commented 1 month ago

@xverizex hi! pardon for delay

so I've tried your PR, but I hit the issue, here is my try

c:\Dev\re\dllToLib>python main.py C:\Windows\System32 C:\masm64\lib64 C:\masm64\include64 shadow
Microsoft (R) COFF/PE Dumper Version 14.29.30154.0
Copyright (C) Microsoft Corporation.  All rights reserved.

  Summary

dumpbin is preset in PATH
Microsoft (R) Library Manager Version 14.29.30154.0
Copyright (C) Microsoft Corporation.  All rights reserved.

lib is preset in PATH
C:\masm64\lib64\
C:\masm64\include64\
list index out of range

any ideas what is wrong? did I run the script as you expected? (appended last param named shadow)

xverizex commented 1 month ago

@greenozon I haven't used this script for a long time, and I don't remember anymore. Try to read the script code, everything is quite clearly written there.

greenozon commented 1 month ago

Good point! I put prints and figured out where it fails need your answer please in the PR question

xverizex commented 1 month ago

@greenozon I'm busy with other project and I don't have time to help anybody.

greenozon commented 1 month ago

OK, thanks no problems

PS how could I help you?

xverizex commented 1 month ago

@greenozon Nothing. I'm making a game.