The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
April 03, 2020, 04:21:46 PM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  Project Support Forums
| |-+  MASM32
| | |-+  Process32First & Process32Next problem.
« previous next »
Pages: [1] Print
Author Topic: Process32First & Process32Next problem.  (Read 17955 times)
-Alex-
Member
**
Gender: Male
Posts: 28



Process32First & Process32Next problem.
« on: February 09, 2012, 01:40:59 AM »

Why I cant use Process32First and Process32Next anymore? I get: error A2006: undefined symbol : Process32First
However, the same project can be compiled with MASM32 v10.
« Last Edit: February 09, 2012, 05:18:36 AM by hutch-- » Logged
dedndave
Member
*****
Posts: 12523


Re: MASM32 Version 11 Release posted.
« Reply #1 on: February 09, 2012, 02:30:54 AM »

oops...
it looks like only the unicode version has a prototype
appears not to be the only one in kernel32.inc like that, too

for a quick test, add these to the beginning of your program...

Code:
IFNDEF Process32First
Process32First PROTO :DWORD,:DWORD
ENDIF

IFNDEF Process32Next
Process32Next PROTO :DWORD,:DWORD
ENDIF
Logged
-Alex-
Member
**
Gender: Male
Posts: 28



Re: MASM32 Version 11 Release posted.
« Reply #2 on: February 09, 2012, 02:42:24 AM »

.obj : error LNK2001: unresolved external symbol _Process32First@8
.obj : error LNK2001: unresolved external symbol _Process32Next@8
.exe : fatal error LNK1120: 2 unresolved externals
Logged
dedndave
Member
*****
Posts: 12523


Re: MASM32 Version 11 Release posted.
« Reply #3 on: February 09, 2012, 02:58:36 AM »

my mistake - they didn't get imported into kernel32.lib, of course
Logged
dedndave
Member
*****
Posts: 12523


Re: MASM32 Version 11 Release posted.
« Reply #4 on: February 09, 2012, 03:03:46 AM »

...and, i forgot the "A"
Code:
IFNDEF Process32FirstA
Process32FirstA PROTO :DWORD,:DWORD
ENDIF

IFNDEF Process32First
Process32First TEXTEQU <Process32FirstA>
ENDIF

IFNDEF Process32NextA
Process32NextA PROTO :DWORD,:DWORD
ENDIF

IFNDEF Process32Next
Process32Next TEXTEQU <Process32NextA>
ENDIF

if that doesn't work, we'll have to make a new kernel32.lib
in the mean time, you can use GetProcAddress
Logged
-Alex-
Member
**
Gender: Male
Posts: 28



Re: MASM32 Version 11 Release posted.
« Reply #5 on: February 09, 2012, 03:07:43 AM »

Process32First dont have an "A", only "W", still dont help. Can you make new lib?
Logged
dedndave
Member
*****
Posts: 12523


Re: MASM32 Version 11 Release posted.
« Reply #6 on: February 09, 2012, 03:16:20 AM »

this worked for me
Code:
IFNDEF Process32FirstA
Process32FirstA PROTO :DWORD,:DWORD
ENDIF

IFNDEF Process32First
Process32First TEXTEQU <Process32FirstA>
ENDIF

IFNDEF Process32NextA
Process32NextA PROTO :DWORD,:DWORD
ENDIF

IFNDEF Process32Next
Process32Next TEXTEQU <Process32NextA>
ENDIF
Logged
-Alex-
Member
**
Gender: Male
Posts: 28



Re: MASM32 Version 11 Release posted.
« Reply #7 on: February 09, 2012, 03:17:58 AM »

same error as before, unresolved external symbol _Process32FirstA@8
Logged
dedndave
Member
*****
Posts: 12523


Re: MASM32 Version 11 Release posted.
« Reply #8 on: February 09, 2012, 03:27:18 AM »

sorry - i thought it worked - i had a pre-existing EXE file in the folder, so i thought it linked properly

the problem with creating a new lib is...
it appears there are several (or many) functions that need to be "fixed"
i don't feel like fixing them all   Tongue

you can make one using inc2lib...
add the ASCII prototypes to kernel32.inc
Code:
Process32FirstA PROTO :DWORD,:DWORD
Process32NextA PROTO :DWORD,:DWORD

in the existing kernel32.inc, you will find these aliases...
Code:
IFDEF __UNICODE__
  Process32First equ <Process32FirstW>
ENDIF

IFDEF __UNICODE__
  Process32Next equ <Process32NextW>
ENDIF

modify them like so...
Code:
IFDEF __UNICODE__
  Process32First equ <Process32FirstW>
ELSE
  Process32First equ <Process32FirstA>
ENDIF

IFDEF __UNICODE__
  Process32Next equ <Process32NextW>
ELSE
  Process32Next equ <Process32NextA>
ENDIF
then use inc2lib to create a new lib

or, you can wait for Hutch to update it   Tongue
he will probably take care of this in the next day or so
Logged
Ramon Sala
Easy Code programmer
Member
*****
Gender: Male
Posts: 425


Re: Process32First & Process32Next problem.
« Reply #9 on: February 09, 2012, 08:32:17 AM »

Hi Alex,

The problem is that the Process32FirstA and Process32NextA do not exist. The ANSI versions are named Process32First and Process32Next, while the Unicode versions are Process32FirstW and Process32NextW. The Kernek.inc file coming with MASM32 v11 has the following declarations (and I'm the responsible):

Module32FirstW PROTO STDCALL :DWORD,:DWORD
IFDEF __UNICODE__
  Module32First equ <Module32FirstW>
ENDIF

Module32NextW PROTO STDCALL :DWORD,:DWORD
IFDEF __UNICODE__
  Module32Next equ <Module32NextW>
ENDIF


and according to Microsoft they should be:

Module32First PROTO STDCALL :DWORD,:DWORD
Module32FirstW PROTO STDCALL :DWORD,:DWORD

Module32Next PROTO STDCALL :DWORD,:DWORD
Module32NextW PROTO STDCALL :DWORD,:DWORD


So lines:

Module32First PROTO STDCALL :DWORD,:DWORD
Module32Next PROTO STDCALL :DWORD,:DWORD


are missing.


This is what MSDN says for Module32First (the same applies to Module32Next):

Header
Tlhelp32.h

Library   
Kernel32.lib

DLL
Kernel32.dll

Unicode and ANSI names
Module32FirstW (Unicode) and Module32First (ANSI)


Regards,
Logged

Greetings from Catalonia
diablo2oo2
Member
**
Posts: 48


Re: Process32First & Process32Next problem.
« Reply #10 on: March 12, 2012, 04:06:59 PM »

this should be fixed in the latest SDK
Logged
donkey
Member
*****
Posts: 3789


ASS-embler


Re: Process32First & Process32Next problem.
« Reply #11 on: March 13, 2012, 04:21:01 PM »

You should also make sure you use the proper structures, the UNICODE and ANSI versions of PROCESSENTRY32 and MODULEENTRY32 are different sizes because of character width (TCHAR).

Logged

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable
Gunner
Member
*****
Gender: Male
Posts: 687

What the hell, why not.


Re: Process32First & Process32Next problem.
« Reply #12 on: March 14, 2012, 02:21:17 AM »

Where is outCLSID defined?

Mods will probably close this topic now and remove that link since it seems to be source for something malicious and we don't help with that.
Logged

~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com
-Alex-
Member
**
Gender: Male
Posts: 28



Re: Process32First & Process32Next problem.
« Reply #13 on: March 14, 2012, 08:36:49 AM »

For all others who have same prob like me before, here is simple solution:

Change in kernel32.inc

Process32FirstW PROTO STDCALL :DWORD,:DWORD
Process32NextW PROTO STDCALL :DWORD,:DWORD

to

Process32First PROTO STDCALL :DWORD,:DWORD
Process32Next PROTO STDCALL :DWORD,:DWORD

and make a new kernel32.lib or take the one from windows sdk.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!