Perhaps some you know about PElock found at www.pelock.com
I'm using Dev C++ 4.9.9.2 on Windows 2000
I'm trying to add DEMO_START and DEMO_END to prevent the running of specific code in a function. I have #include "pelock.h" at the top.
But the compilation error I receive is
expected '(' before "_emit"
expected esm body before " _emit"
' _emit' undeclared (first use this function)
expected ';' before numeric constant
expected '(' before "_emt"
expected asm body before "_emt"
expected ';' before numeric constant [build error][myapp.o] Error 1
When I look at pelock.h code I notice that they define DEMO_START like this .
define DEMO_START emit (...some hex code...)
define DEMO_END emit (...some more hex code...)
define DEMO START \
asm emit
So does anyone have any idea why my program refuses to compile ? and does anyone have a solution for how I can get it to compile ?
Thanks
Stev
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The errors are listed for lines 768 and 771 of biblebowl-06.cpp, so that would need to be what you post, but the message is quite clear, you are passing an unsigned char pointer to a CHAR pointer, which presumably is signed (its a typedef or a macro in <windows.h>).
The best solution is to fix the type agreement in biblebowl-06.cpp. You could kludge it by modifying the macros in pelock.h thus:
for example (note the cast on the second parameter of GetWindowText). It would be far better to fix biblebowl-06.cpp.
As for your other problem, I am afraid I have no interest in looking at this problem for you since I have no specific interest in this tool, and I would only be reading the provided documentation - and you could do that.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Firstly, always post the Compile Log text without modifciation. It includes a huge amount of information that you have omitted from your 'log'. Note the text should be from teh "Compile Log" tab, not the "Compiler" tab - which is filtered.
emit is a compiler extension (not supported by GNU) that inserts bytes directly into the object code. It allows machine code to be inserted directly and so allows instructions not supported by the in-line assembler or which the in-line assembler may otherwise modify to be inserted verbatim.
I have no idea how ir if this can be done in GCC.
Borland (or rather after numerous name changes; Embarcadero), provide a number of their compilers both ancient and modern for free. The command line only Borland C++ 5.5, and the GUI TurboExplorer C++ (a cut down C++ Builder) are for free.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
-- correct me if I'm wrong but it seems like you are suggesting that I put all my code into the GUI TurboExplorer C++ environment in order to Compile with pelock.h
Let me ask you this -- Is there another application like the pelock software (which provide key and registration protection) that I can compile with Dev C++ 4.9.9.2.
Since I already have quite a bit of code in Dev C++, I'm concerned about moving it over to GUI TurboExplorer - ( i'm using a few different components ) and getting it to work.
I think I would prefer to just use another key registration solution. Here's what I mean by Key Registration . I mean it is going to create a unique ID based upon the person's PC Hardware Settings. the user will send that ID to me and I'll send him, I'll run it through the system where it generates an unlock key to allow the user to unlock the software .
I am also looking for something that supports expiration dates etc.
If you know anything that already works with DevC++ please let me know .
Thank you very much to Clifford and anyone else who can answer this question. I'd like to start and finish this project with Dev C++
Stephen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> -- correct me if I'm wrong
You are wrong. I was merely saying that if you wanted to use code that was Borland compiler specific you ought to consider using a Borland compiler. I cannot say whether or not it was intended for that specific Borland compiler (to be completely correct it is not Borland any longer in any case, but Embarcadero, but that will probably change next week!).
As it happens you were also wrong about the code being Borland specific in any case.
I just took a look at pelock.h and you did not tell the whole story. The comment "borland cpp compiler" appears just above a conditional compilation block specific to that compiler. There are also implementations for Intel and LCC compilers and a default implementation (which won't work with GCC). If you are using GCC the macro BORLANDC should not be defined, so I am not sure how you managed to include that code in your build.
You still have not posted the Compile Log despite the explicit request, so it is hard to figure out what you have done.
The code has no GCC specific section, but I believe that the LCC syntax is identical, so all you need do is change the line:
#ifdef LCC
to
#if defined LCC || defined GNUC
That still does not explain how it selected the Borland code. Make sure you have not define BORLANDC. I cannot think why you would do that though.
If that does not fix it and you cannot see why, you must post the log as directed!
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
biblebowl-06.cpp: In function bool FrameFunc()':
biblebowl-06.cpp:763: error:_asm' undeclared (first use this function)
biblebowl-06.cpp:763: error: (Each undeclared identifier is reported only once for each function it appears in.)
I made the change and it finally compiled successfully.
However I don't think I'm getting the expected functionality from PELock (unless I'm doing something wrong).
1st-- I'm under the impression that if I simply add #include pelock.h
and put DEMO_START and DEMO_END around a block of code that shouldn't execute in the DEMO Version, it will not execute. But I find that it does execute and I'm able to run my entire program normally.
2nd-- I tried to copy and paste a simple example from the sample code as seen below to see if would work, but now I get a compiler error again as pasted below (and I copied directly from the sample code).
Greetings;
Perhaps some you know about PElock found at www.pelock.com
I'm using Dev C++ 4.9.9.2 on Windows 2000
I'm trying to add DEMO_START and DEMO_END to prevent the running of specific code in a function. I have #include "pelock.h" at the top.
But the compilation error I receive is
expected '(' before "_emit"
expected esm body before " _emit"
' _emit' undeclared (first use this function)
expected ';' before numeric constant
expected '(' before "_emt"
expected asm body before "_emt"
expected ';' before numeric constant
[build error] [myapp.o] Error 1
When I look at pelock.h code I notice that they define DEMO_START like this .
define DEMO_START emit (...some hex code...)
define DEMO_END emit (...some more hex code...)
define DEMO START \
asm emit
So does anyone have any idea why my program refuses to compile ? and does anyone have a solution for how I can get it to compile ?
Thanks
Stev
The errors are listed for lines 768 and 771 of biblebowl-06.cpp, so that would need to be what you post, but the message is quite clear, you are passing an unsigned char pointer to a CHAR pointer, which presumably is signed (its a typedef or a macro in <windows.h>).
The best solution is to fix the type agreement in biblebowl-06.cpp. You could kludge it by modifying the macros in pelock.h thus:
/ get user defined key data /
define GetRegistrationName(szRegistrationName,iMaxLen) GetWindowText( (HWND)-1, (CHAR*)szRegistrationName, iMaxLen)
for example (note the cast on the second parameter of GetWindowText). It would be far better to fix biblebowl-06.cpp.
As for your other problem, I am afraid I have no interest in looking at this problem for you since I have no specific interest in this tool, and I would only be reading the provided documentation - and you could do that.
Clifford
by the way in pelock.h I notice in the comments it says
borland cpp compiler
any thoughts ?
Thanks
Firstly, always post the Compile Log text without modifciation. It includes a huge amount of information that you have omitted from your 'log'. Note the text should be from teh "Compile Log" tab, not the "Compiler" tab - which is filtered.
emit is a compiler extension (not supported by GNU) that inserts bytes directly into the object code. It allows machine code to be inserted directly and so allows instructions not supported by the in-line assembler or which the in-line assembler may otherwise modify to be inserted verbatim.
I have no idea how ir if this can be done in GCC.
Borland (or rather after numerous name changes; Embarcadero), provide a number of their compilers both ancient and modern for free. The command line only Borland C++ 5.5, and the GUI TurboExplorer C++ (a cut down C++ Builder) are for free.
Clifford
Hey Clifford,
I want to thank you very much for that answer.
-- correct me if I'm wrong but it seems like you are suggesting that I put all my code into the GUI TurboExplorer C++ environment in order to Compile with pelock.h
Let me ask you this -- Is there another application like the pelock software (which provide key and registration protection) that I can compile with Dev C++ 4.9.9.2.
Since I already have quite a bit of code in Dev C++, I'm concerned about moving it over to GUI TurboExplorer - ( i'm using a few different components ) and getting it to work.
I think I would prefer to just use another key registration solution. Here's what I mean by Key Registration . I mean it is going to create a unique ID based upon the person's PC Hardware Settings. the user will send that ID to me and I'll send him, I'll run it through the system where it generates an unlock key to allow the user to unlock the software .
I am also looking for something that supports expiration dates etc.
If you know anything that already works with DevC++ please let me know .
Thank you very much to Clifford and anyone else who can answer this question. I'd like to start and finish this project with Dev C++
Stephen
> -- correct me if I'm wrong
You are wrong. I was merely saying that if you wanted to use code that was Borland compiler specific you ought to consider using a Borland compiler. I cannot say whether or not it was intended for that specific Borland compiler (to be completely correct it is not Borland any longer in any case, but Embarcadero, but that will probably change next week!).
As it happens you were also wrong about the code being Borland specific in any case.
I just took a look at pelock.h and you did not tell the whole story. The comment "borland cpp compiler" appears just above a conditional compilation block specific to that compiler. There are also implementations for Intel and LCC compilers and a default implementation (which won't work with GCC). If you are using GCC the macro BORLANDC should not be defined, so I am not sure how you managed to include that code in your build.
You still have not posted the Compile Log despite the explicit request, so it is hard to figure out what you have done.
The code has no GCC specific section, but I believe that the LCC syntax is identical, so all you need do is change the line:
#ifdef LCC
to
#if defined LCC || defined GNUC
That still does not explain how it selected the Borland code. Make sure you have not define BORLANDC. I cannot think why you would do that though.
If that does not fix it and you cannot see why, you must post the log as directed!
Clifford
Thanks Again for the assist.
Before making any changes to pelock.h, my compiler log was showing
[code]
Compiler: Default compiler
Building Makefile: "C:\biblebowl-plus-voice2\biblebowl\Makefile.win"
Executing make clean
rm -f biblebowl-06.o to-do-list.o Player.o menuitem.o FormInputConfig.o tinyxmlparser.o tinyxml.o tinyxmlerror.o tinystr.o QuestionManager.o ConfigSettings.o ScoreBoards.o AnswerAlgorithm.o FormInput.o NPC.o Behavior.o Buzzer.o QuestionnerBehavior.o Speech.o QuestionDB.o ThreadManager.o Confetti.o Stage.o hge-experiments.exe
g++.exe -DDEBUG -c biblebowl-06.cpp -o biblebowl-06.o -I"C:/Dev-Cpp4992/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp4992/include/c++/3.4.2/backward" -I"C:/Dev-Cpp4992/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp4992/include/c++/3.4.2" -I"C:/Dev-Cpp4992/include" -I"C:/Microsoft Speech SDK 5.1/Include" -I"C:/biblebowl-plus-voice2/biblebowl/hge16/hge16/include" -I"C:/biblebowl-plus-voice2/biblebowl/hge16/hge16/include/src" -g3
biblebowl-06.cpp: In function
bool FrameFunc()': biblebowl-06.cpp:763: error: expected
(' before "_emit"biblebowl-06.cpp:763: error: expected asm body before "_emit"
biblebowl-06.cpp:763: error: `_emit' undeclared (first use this function)
biblebowl-06.cpp:763: error: (Each undeclared identifier is reported only once for each function it appears in.)
biblebowl-06.cpp:763: error: expected `;' before numeric constant
biblebowl-06.cpp:855: error: expected `(' before "_emit"
biblebowl-06.cpp:855: error: expected asm body before "_emit"
biblebowl-06.cpp:855: error: expected `;' before numeric constant
make.exe: *** [biblebowl-06.o] Error 1
Execution terminated
[code]
After making the change to pelock.h you suggested, pelock.h looks like this
ifndef PELOCK_MACROS
#if defined LCC || defined GNUC
And the compiler log now looks like this
[code]
Compiler: Default compiler
Building Makefile: "C:\biblebowl-plus-voice2\biblebowl\Makefile.win"
Executing make clean
rm -f biblebowl-06.o to-do-list.o Player.o menuitem.o FormInputConfig.o tinyxmlparser.o tinyxml.o tinyxmlerror.o tinystr.o QuestionManager.o ConfigSettings.o ScoreBoards.o AnswerAlgorithm.o FormInput.o NPC.o Behavior.o Buzzer.o QuestionnerBehavior.o Speech.o QuestionDB.o ThreadManager.o Confetti.o Stage.o hge-experiments.exe
g++.exe -DDEBUG -c biblebowl-06.cpp -o biblebowl-06.o -I"C:/Dev-Cpp4992/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp4992/include/c++/3.4.2/backward" -I"C:/Dev-Cpp4992/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp4992/include/c++/3.4.2" -I"C:/Dev-Cpp4992/include" -I"C:/Microsoft Speech SDK 5.1/Include" -I"C:/biblebowl-plus-voice2/biblebowl/hge16/hge16/include" -I"C:/biblebowl-plus-voice2/biblebowl/hge16/hge16/include/src" -g3
biblebowl-06.cpp: In function
bool FrameFunc()': biblebowl-06.cpp:763: error:
_asm' undeclared (first use this function)biblebowl-06.cpp:763: error: (Each undeclared identifier is reported only once for each function it appears in.)
make.exe: *** [biblebowl-06.o] Error 1
Execution terminated
[/code]
Thanks again for the assistance with this one.
Stephen
Related
Code: code
My mistake, the GNU inline assembler keyword is either asm or asm
A quick fix (add three lines after the LCC/GNUC conditional
ifndef PELOCK_MACROS
if defined LCC || defined GNUC
#if defined GNUC
define _asm asm
endif
If that does not work, then the LCC syntax may be entirely incompatible with GNU and you;ll be better off defining a new separate block.
This may help: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
Clifford
Thanks Clifford;
I made the change and it finally compiled successfully.
However I don't think I'm getting the expected functionality from PELock (unless I'm doing something wrong).
1st-- I'm under the impression that if I simply add #include pelock.h
and put DEMO_START and DEMO_END around a block of code that shouldn't execute in the DEMO Version, it will not execute. But I find that it does execute and I'm able to run my entire program normally.
2nd-- I tried to copy and paste a simple example from the sample code as seen below to see if would work, but now I get a compiler error again as pasted below (and I copied directly from the sample code).
Here's the compiler error.
Compiler: Default compiler
Building Makefile: "C:\biblebowl-plus-voice2\biblebowl\Makefile.win"
Executing make clean
rm -f biblebowl-06.o to-do-list.o Player.o menuitem.o FormInputConfig.o tinyxmlparser.o tinyxml.o tinyxmlerror.o tinystr.o QuestionManager.o ConfigSettings.o ScoreBoards.o AnswerAlgorithm.o FormInput.o NPC.o Behavior.o Buzzer.o QuestionnerBehavior.o Speech.o QuestionDB.o ThreadManager.o Confetti.o Stage.o hge-experiments.exe
g++.exe -DDEBUG -c biblebowl-06.cpp -o biblebowl-06.o -I"C:/Dev-Cpp4992/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp4992/include/c++/3.4.2/backward" -I"C:/Dev-Cpp4992/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp4992/include/c++/3.4.2" -I"C:/Dev-Cpp4992/include" -I"C:/Microsoft Speech SDK 5.1/Include" -I"C:/biblebowl-plus-voice2/biblebowl/hge16/hge16/include" -I"C:/biblebowl-plus-voice2/biblebowl/hge16/hge16/include/src" -g3
biblebowl-06.cpp: In function
bool FrameFunc()': biblebowl-06.cpp:768: error: invalid conversion from
unsigned char' toCHAR*' biblebowl-06.cpp:768: error: initializing argument 2 of
int GetWindowTextA(HWND__, CHAR*, int)'biblebowl-06.cpp:771: error: invalid conversion from
unsigned char*' to
CHAR'biblebowl-06.cpp:771: error: initializing argument 2 of `int GetWindowTextA(HWND__, CHAR*, int)'
make.exe: *** [biblebowl-06.o] Error 1
Execution terminated
The relevant code for those functions in pelock.h are
/ PELock v1.06, Bartosz Wojcik /
ifndef PELOCK
define PELOCK
/ license key system callbacks /
/ retrieve registration name from license key file /
define GetRegistrationName(szRegistrationName,iMaxLen) GetWindowText( (HWND)-1,szRegistrationName,iMaxLen)
/ set license key path (other than application directory /
define SetRegistrationKey(szRegistrationKeyPath) GetWindowText( (HWND)-2,szRegistrationKeyPath,0)
/ get user defined key data /
define GetKeyData(iValue) GetWindowText( (HWND)-3,NULL,iValue)
/ get hardware id /
define GetHardwareId(szHardwareId,iMaxLen) GetWindowText( (HWND)-4,szHardwareId,iMaxLen)
He says these functions use something called "Hooking" -- So I don't know if this is also not compatible with Dev C++
Any thoughts would be greatly appreciated.
STephen