News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

undefined symbol error

Started by skywalker, March 28, 2006, 09:42:09 PM

Previous topic - Next topic

skywalker

I am getting an undefined symbol for SHDeleteKey.
I did a google and altavista search for some help but couldn't find anything.

; SHdelete.asm   Delete a key and it's subkeys
;
    .386
    .model flat, stdcall
    option casemap :none   ; case sensitive

include     \masm32\include\windows.inc
include     \masm32\include\user32.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\advapi32.inc

includelib  \masm32\lib\user32.lib
includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\advapi32.lib
includelib  \masm32\lib\shlwapi.lib

.data

szKeyName       BYTE      "Software\MASM\Registry Test\",0

.code

start:

invoke SHDeleteKey,HKEY_LOCAL_MACHINE,ADDR szKeyName
invoke ExitProcess,NULL

end start

donkey

You have to include the .inc file for SHLWAPI as well as the lib file otherwise the PROTO is not defined.

include  \masm32\include\shlwapi.inc

if that doesn't work, it is a string function so try SHDeleteKeyA
"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

skywalker

Quote from: donkey on March 28, 2006, 09:53:07 PM
You have to include the .inc file for SHLWAPI as well as the lib file otherwise the PROTO is not defined.

include  \masm32\include\shlwapi.inc

if that doesn't work, it is a string function so try SHDeleteKeyA

Thanks, it worked like a champ.

This is another question on some other code.
Is the fn a macro in the macros.asm file ?

I am having difficulty knowing when to use invoke and fn.
The code is working like I want.


fn WriteProfileString, Offset szname, ADDR key, ADDR value
fn GetProfileInt,Offset szname,ADDR key,0

;int 3           ; see if the value matches what should be there
.if EAX==45
;put your code here

invoke MessageBox, 0, ADDR valueOK, ADDR Sample,MB_ICONINFORMATION

MichaelW

The fn macro just adds quoted text support, so it is useful only when you are passing quoted strings. The rv macro adds quoted text support and returns eax, so you can use statements like this:

mov   hInstance, rv(GetModuleHandle, "test")


eschew obfuscation

skywalker

Quote from: MichaelW on March 29, 2006, 01:14:28 AM
The fn macro just adds quoted text support, so it is useful only when you are passing quoted strings. The rv macro adds quoted text support and returns eax, so you can use statements like this:

mov   hInstance, rv(GetModuleHandle, "test")


Thanks, I'll study it.