Click here to Skip to main content
15,915,513 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
David Crow22-Jan-10 4:21
David Crow22-Jan-10 4:21 
QuestionThe Boss and the Worker Pin
Rozis21-Jan-10 13:34
Rozis21-Jan-10 13:34 
AnswerRe: The Boss and the Worker Pin
Mattias G21-Jan-10 13:45
Mattias G21-Jan-10 13:45 
GeneralRe: The Boss and the Worker Pin
Rozis22-Jan-10 12:06
Rozis22-Jan-10 12:06 
AnswerRe: The Boss and the Worker Pin
iceman861621-Jan-10 15:03
iceman861621-Jan-10 15:03 
GeneralRe: The Boss and the Worker Pin
Rozis22-Jan-10 12:07
Rozis22-Jan-10 12:07 
AnswerRe: The Boss and the Worker Pin
Adam Roderick J21-Jan-10 17:51
Adam Roderick J21-Jan-10 17:51 
GeneralRe: The Boss and the Worker Pin
Rozis22-Jan-10 12:05
Rozis22-Jan-10 12:05 
Thanks for your replies. I try to answer you all 3 at once:

First Matias: In real life a worker will be hired first, and this salary-thing wouldn't be a problem. Problem is that in my example there is only a boss and some workers. If you have access to this system you could easily derive a class from Worker (sub-class, inherit from, however you name it) that would have malicous code; so the worker gets salary twice a day.

Adam: I like your idea to make derived classes good worker and bad worker but i don't see how this can solve the problem: deriving a malicious class from Goodworker would be even simpler. But the idea to create a Badworker too is intriguing and maybe usefull, but i don't see how yet.

Iceman: I myself was thinking the same way, and maybe you can help me with some more ideas.

What i want is a worker-class that can not be tampered with. So it may not be derived and there may not be a another class that can have the same name. If I create Getsalary() like thiis: (in pseudo-code)

Class Boss

method Getsalary(oworker)
...

We can ensure that the argument oworker must be of class Worker (or a derived class) by strongtyping oworker. I found a way to check if oworker is not a derived one. And here OO stops: Boss can not be sure if it is the 'right' untampered version of Worker or just a fake.

I was thinking to implement some kind of shared secret, when the worker ask Salary it must solve a riddle first.

If the source of both objects is known this will not work, so at least one of them must be published in a DLL (or something) that hides the solving of the riddle...

Placing code in a DLL is not a strong one (you can replace it). So i need really good ideas how to create this kind of security.

Maybe it is possible to do some variable encryption, like this:
Boss calls a method of Worker. This decrypts a internal piece of data in Worker, Worker sends this data when it invokes Getsalary. Boss checks this data. If the data was ok salary is paid otherwise not.

Feel free to give me more suggestions and thanks so far...
Questionc++ integration subroutine. Pin
mrby12321-Jan-10 12:50
mrby12321-Jan-10 12:50 
AnswerRe: c++ integration subroutine. Pin
Mattias G21-Jan-10 12:55
Mattias G21-Jan-10 12:55 
GeneralRe: c++ integration subroutine. Pin
mrby12321-Jan-10 13:05
mrby12321-Jan-10 13:05 
GeneralRe: c++ integration subroutine. Pin
Mattias G21-Jan-10 13:21
Mattias G21-Jan-10 13:21 
QuestionCompiling an assembly file with Visual Studio Pin
Jim Crafton21-Jan-10 8:44
Jim Crafton21-Jan-10 8:44 
AnswerRe: Compiling an assembly file with Visual Studio Pin
Jim Crafton21-Jan-10 8:47
Jim Crafton21-Jan-10 8:47 
QuestionDialog hang Pin
Member 686483921-Jan-10 8:22
Member 686483921-Jan-10 8:22 
AnswerRe: Dialog hang Pin
Mattias G21-Jan-10 12:39
Mattias G21-Jan-10 12:39 
GeneralRe: Dialog hang Pin
Member 686483922-Jan-10 6:38
Member 686483922-Jan-10 6:38 
GeneralRe: Dialog hang Pin
Mattias G22-Jan-10 11:13
Mattias G22-Jan-10 11:13 
QuestionDisabling Entire MFC ActiveX Control Pin
wgoodwater21-Jan-10 7:47
wgoodwater21-Jan-10 7:47 
AnswerRe: Disabling Entire MFC ActiveX Control Pin
LunaticFringe21-Jan-10 8:31
LunaticFringe21-Jan-10 8:31 
GeneralRe: Disabling Entire MFC ActiveX Control Pin
wgoodwater21-Jan-10 8:33
wgoodwater21-Jan-10 8:33 
GeneralRe: Disabling Entire MFC ActiveX Control Pin
LunaticFringe21-Jan-10 8:40
LunaticFringe21-Jan-10 8:40 
QuestionCannot remove popup from CVSListbox - Help????? [modified] Pin
gamejunk21-Jan-10 7:20
gamejunk21-Jan-10 7:20 
QuestionCMFCStatusBar in ActiveX control without Title Bar Pin
wgoodwater21-Jan-10 5:33
wgoodwater21-Jan-10 5:33 
Questionmy list error! Pin
wbgxx21-Jan-10 4:54
wbgxx21-Jan-10 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.