Page 1 of 1

Compiler error for ProcessIdToSessionId

Posted: Sun Feb 19, 2023 2:14 am
by BarryG
[Edit] Sorry, forgot that I posted about this before -> viewtopic.php?f=43&t=78145

Re: Compiler error for ProcessIdToSessionId

Posted: Mon Feb 20, 2023 5:36 am
by juergenkulow

Code: Select all

// !db 'ProcessIdToSessionId',0x0
db 'ProcessIdToSessionId',0x0
"db 'ProcessIdToSessionId',0x0" is valid programming code in FASM, but unfortunately not in C programming language.
Mijikai Re: detect if windows session is locked

Code: Select all

PureBasic 6.01 LTS beta 4 - C Backend (Windows - x64)
Loading 'C' subsystem
Compiling D:\p2s.pb
Loading external libraries...
Starting compilation...
43 lines processed.
Error: Assembler
error: 'db' undeclared (first use in this function)
 db 'ProcessIdToSessionId',0x0
 ^~
purebasic.c:224:1: note: each undeclared identifier is reported only once For each function it appears in
purebasic.c:224:3: error: expected ';' before '\x6f6e4964'
 db 'ProcessIdToSessionId',0x0
   ^~~~~~~~~~~~~~~~~~~~~~~
   ;
purebasic.c:228:4: warning: character constant too long For its type
 db 'WTSQuerySessionInformationW',0x0
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
purebasic.c:228:3: error: expected ';' before '\x696f6e57'
 db 'WTSQuerySessionInformationW',0x0
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ;
purebasic.c:232:4: warning: character constant too long For its type
 db 'WTSFreeMemory',0x0
    ^~~~~~~~~~~~~~~
purebasic.c:232:3: error: expected ';' before '\x6d6f7279'
 db 'WTSFreeMemory',0x0
   ^~~~~~~~~~~~~~~~
   ;
purebasic.c:136:1: error: label 'll_islocked_wtsfreememory' used but Not defined
 integer p2=(integer)la_ll_islocked_wtsfreememory;
 ^~~~~~~
purebasic.c:132:1: error: label 'll_islocked_wtsquerysessioninformation' used but Not defined
 integer p1=(integer)la_ll_islocked_wtsquerysessioninformation;
 ^~~~~~~

Re: [Done] Compiler error for ProcessIdToSessionId

Posted: Mon Feb 20, 2023 5:40 pm
by mk-soft
There are already some codes here that generate different code with CompilerIf options for ASM and C-backend.

Unfortunately, I also see some that implement ASM adapted in C-backend. But these codes do not run on ARM processors. And when the first PB version for Window ARM comes (is planned in the futures), then the problems with ASM will start again.

Re: [Done] Compiler error for ProcessIdToSessionId

Posted: Mon Feb 20, 2023 5:42 pm
by Fred
PB ARM uses the C backend, so it shouldn't be an issue if you write a C version of your subroutine

Re: [Done] Compiler error for ProcessIdToSessionId

Posted: Mon Feb 20, 2023 5:54 pm
by mk-soft
I am aware of that,

but some people put ASM-Intel commands in the c-backend, which then leads to errors on ARM.
I just wanted to remind you that this is not a good way.

Re: [Done] Compiler error for ProcessIdToSessionId

Posted: Mon Feb 20, 2023 6:01 pm
by Fred
Ho yes, you're totally right here.

Re: [Done] Compiler error for ProcessIdToSessionId

Posted: Tue Feb 21, 2023 6:08 am
by juergenkulow

Code: Select all

; EnableASM  or ! somecode(); generates an Error Message in C Backend. 
CompilerIf #PB_Backend_C=#PB_Compiler_Backend
  CompilerError "Inline assembler is not allowed in C backend."
CompilerEndIf