Author Topic: knownfolders.h  (Read 546 times)

LiaoMi

  • Member
  • ****
  • Posts: 922
knownfolders.h
« on: April 04, 2021, 06:35:40 AM »
Hi TouEnMasm,

are you sure that knownfolders.h file is translated correctly? The problem is not the name, your version looks like

Code: [Select]
;
;    Copyright (C) Microsoft.  All rights reserved.
;
;ECHO   once
Include winapifamily.inc
;ECHO   region Desktop Family
IF  WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
IFDEF DEFINE_KNOWN_FOLDER
ENDIF
IF DEFINED(INITGUID) OR DEFINED(INITKNOWNFOLDERS)
ELSE
DEFINE_KNOWN_FOLDER equ < name_, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8>
ENDIF ; INITGUID || INITKNOWNFOLDERS
; legacy CSIDL value: CSIDL_NETWORK
; display name: "Network"
; legacy display name: "My Network Places"
; default path:
; {D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}
DEFINE_KNOWN_FOLDER PROTO :FOLDERID_NetworkFolder ,:0xD20BEEC4 ,:0x5CA8 ,:0x4905 ,:0xAE ,:0x3B ,:0xBF ,:0x25 ,:0x1E ,:0xA0 ,:0x9B ,:0x53
; {0AC0837C-BBF8-452A-850D-79D08E667CA7}
DEFINE_KNOWN_FOLDER PROTO :FOLDERID_ComputerFolder ,:0x0AC0837C ,:0xBBF8 ,:0x452A ,:0x85 ,:0x0D ,:0x79 ,:0xD0 ,:0x8E ,:0x66 ,:0x7C ,:0xA7
; {4D9F7874-4E0C-4904-967B-40B0D20C3E4B}

I get an error with any name
Code: [Select]
Assembling: security.asm
Translated Windows SDK 10.0 32 bits
C:\masm64\sdkrc100\um\knownfolders.inc(19) : error A2008: syntax error : name_
 C:\masm64\sdkrc100\um\knownfolders.inc(19): Included by
  C:\masm64\sdkrc100\um\shlguid.inc(503): Included by
   C:\masm64\sdkrc100\um\ShlObj.inc(85): Included by
    security.asm(20): Main line code

This is how it looks from the package ObjAsm or ASMC..

ObjAsm
Code: [Select]
;Include file created by h2incX, Version B.01.01, 10/09/2018 22:03
;(C) 2018-today by Biterider, 2005-2009 by Japheth
;Source file: '\ObjAsm\Projects\h2IncX\header\knownfolders.h', last modified: 19/04/2018 10:46
;Creation parameters:

include winapifamily.inc
if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  ifdef DEFINE_KNOWN_FOLDER
  endif
  if Defined(INITGUID) or Defined(INITKNOWNFOLDERS)
    DEFINE_KNOWN_FOLDER macro name_, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8
      externdef name_:GUID
      name_ GUID { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
    endm
  else
    DEFINE_KNOWN_FOLDER macro name_, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8
      ;Creare a symbol with a GUID formatet conten => 00000000-0000-0000-0000-000000000000
      externdef name_:GUID
      @CatStr(<s>,name_,< textequ !<>,sGUIDf(l,8),<->,sGUIDf(w1,4),<->,sGUIDf(w2,4),<->,sGUIDf(b1,2),sGUIDf(b2,2),<->,sGUIDf(b3,2),sGUIDf(b4,2),sGUIDf(b5,2),sGUIDf(b6,2),sGUIDf(b7,2),sGUIDf(b8,2),<!>>)
    endm
  endif
  DEFINE_KNOWN_FOLDER FOLDERID_NetworkFolder, 0D20BEEC4h, 5CA8h, 4905h, 0AEh, 3Bh, 0BFh, 25h, 1Eh, 0A0h, 9Bh, 53h
  DEFINE_KNOWN_FOLDER FOLDERID_ComputerFolder, 0AC0837Ch, 0BBF8h, 452Ah, 85h, 0Dh, 79h, 0D0h, 8Eh, 66h, 7Ch, 0A7h
  DEFINE_KNOWN_FOLDER FOLDERID_InternetFolder, 4D9F7874h, 4E0Ch, 4904h, 96h, 7Bh, 40h, 0B0h, 0D2h, 0Ch, 3Eh, 4Bh

ASMC
Code: [Select]
DEFINE_KNOWN_FOLDER macro name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8
ifdef __PE__
_&name& equ <{l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}>
elseifdef INITGUID
echo name GUID {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
else
externdef name:GUID
endif
    exitm<>
    endm

DEFINE_KNOWN_FOLDER(FOLDERID_NetworkFolder, 0xD20BEEC4, 0x5CA8, 0x4905, 0xAE, 0x3B, 0xBF, 0x25, 0x1E, 0xA0, 0x9B, 0x53)
DEFINE_KNOWN_FOLDER(FOLDERID_ComputerFolder,   0x0AC0837C, 0xBBF8, 0x452A, 0x85, 0x0D, 0x79, 0xD0, 0x8E, 0x66, 0x7C, 0xA7)

Only the version from @Biterider works with your SDK ... I use ASMC for final release.

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: knownfolders.h
« Reply #1 on: July 06, 2021, 01:05:36 AM »
Hello,
I am sure it is wrong.
the DEFINE_KNOWN_FOLDER act as a macro without having his forM.
The :DWORD show it is treat as a proto and not as a macro generating GUID.
There is various forms of this macro in the sdk and all are not translated.
The form who is translated is the one generated by midl when he translate idl files to .h header files,it's the DEFINE_GUID.
This one had been created at hand and is just an other name for DEFINE_GUID .The WINDOWS KIT SDK like that and use it a lot
One soluce is to find the idl file and translate it with midl and then used headinc,simple soluces exist see below.



« Last Edit: July 06, 2021, 05:54:25 PM by TouEnMasm »
Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: knownfolders.h
« Reply #2 on: July 06, 2021, 01:50:36 AM »
a little Later after i scracth a little my hand:
Something to do,rename DEFINE_KNOWN_FOLDER in DEFINE_GUID who are translated and see what you get in the attacment:
usage:
.data
FOLDERID_AppDataFavorites GUID sFOLDERID_AppDataFavorites
Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: knownfolders.h
« Reply #3 on: July 06, 2021, 02:19:31 AM »
Second soluce:
Open egales.txt,at the start of the files you see
Quote
DEFINE_GUID            =     =   35   ;
35 is the named function  to translate GUID
Add a line
Quote
DEFINE_KNOWN_FOLDER     =     = 35
and when you translate knownfolders.h you get the correct translation

If you have a look on egales.txt you see there is further name who solve to the same translate as I said in a upper post.
Quote
OUR_GUID_ENTRY      =     =     35
DEFINE_OLEGUID      =     =     35
DEFINE_GUID            =     =   35   ;a traduire shlguid
DEFINE_DEVSVCGUID       =     =   35      ;(SERVICE_AnchorSync, 0x056d8b9e, 0xad7a, 0x44fc, 0x94, 0x6f, 0x1d, 0x63, 0xa2, 0x5c, 0xda, 0x9a );
DEFINE_DEVSVCPROPKEY    =     =   35
DEFINE_DEVPROPKEY     =     =   35
DEFINE_CODECAPI_GUID    =     =   35
DEFINE_KNOWN_FOLDER     =     = 35
the EXTERN_GUID must be very similar but couldn't be translate with the same function (36)





Fa is a musical note to play with CL