fivewin/Harbour encrypt decrypt function in c#
-
- Posts: 28
- Joined: Mon Jun 29, 2015 7:41 am
fivewin/Harbour encrypt decrypt function in c#
Hello,
I have a program written in fivewin nad harbour that encrypt some text in memo fields.
Now i try to incorporate same dbf and fpt in Visualstudio 2013.
I get the dbf and the encrypted memo but i cannot decryt without the decrypt / encrypt functions.
I tried to find the functions source to transalte them in c# but with no luck. It seems they are "only" compiled in .lib file.
Can anyone tell me where or how to get the source?
Or how to include the fivewin .lib in visualstudio project, if possible?
ANOTHER OPTION COULD BE TO CREATE A DLL WITH THE TWO FUNCTION referenced?
Is this possible, and, if yes, how?
Thanks
Lorenzo
I have a program written in fivewin nad harbour that encrypt some text in memo fields.
Now i try to incorporate same dbf and fpt in Visualstudio 2013.
I get the dbf and the encrypted memo but i cannot decryt without the decrypt / encrypt functions.
I tried to find the functions source to transalte them in c# but with no luck. It seems they are "only" compiled in .lib file.
Can anyone tell me where or how to get the source?
Or how to include the fivewin .lib in visualstudio project, if possible?
ANOTHER OPTION COULD BE TO CREATE A DLL WITH THE TWO FUNCTION referenced?
Is this possible, and, if yes, how?
Thanks
Lorenzo
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: fivewin/Harbour encrypt decrypt function in c#
Lorenzo,
We can email you its source code. We don't include it in FWH sources for security reasons.
We can email you its source code. We don't include it in FWH sources for security reasons.
-
- Posts: 28
- Joined: Mon Jun 29, 2015 7:41 am
Re: fivewin/Harbour encrypt decrypt function in c#
Thanks Antonio you are very great!
but it is very difficult to translate a bitwise in c#
do you think it is better to make a dll or something more easy to do?
Lorenzo
but it is very difficult to translate a bitwise in c#
do you think it is better to make a dll or something more easy to do?
Lorenzo
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: fivewin/Harbour encrypt decrypt function in c#
Lorenzo,
You can do bitwise dividing by 2 or multiplying by 2
In example:
01110111 --> 119
Divided by 2:
111011
Multiplied by 2:
11101110
You can do bitwise dividing by 2 or multiplying by 2
In example:
01110111 --> 119
Divided by 2:
111011
Multiplied by 2:
11101110
-
- Posts: 28
- Joined: Mon Jun 29, 2015 7:41 am
Re: fivewin/Harbour encrypt decrypt function in c#
Thank you Antonio, i tried to translate in c# and then i decided to use another way: to call my program from c# ( from a web form) then usa a text file to transfer data from fivewin engine to html using a file.
This works great from Visualstudio 2013 IDE
BUT ( there is always a BUT in Windows 8.1 and 10)
when deployed as a normal c# web app, calling the exe means to call a process in a different "ambient".
So the exe run but in an infinite loop doing nothing visible.
I search on internet for a solution (many), with no luck.
Now i am thinking for a "great" solution if possible; that is, using a "Windows Service" written in harbour/fivewin, able to run my
old functions or program(exe) and pass them arguments.
Did you already make this wheel?
Lorenzo
This works great from Visualstudio 2013 IDE
BUT ( there is always a BUT in Windows 8.1 and 10)
when deployed as a normal c# web app, calling the exe means to call a process in a different "ambient".
So the exe run but in an infinite loop doing nothing visible.
I search on internet for a solution (many), with no luck.
Now i am thinking for a "great" solution if possible; that is, using a "Windows Service" written in harbour/fivewin, able to run my
old functions or program(exe) and pass them arguments.
Did you already make this wheel?
Lorenzo
Re: fivewin/Harbour encrypt decrypt function in c#
Lorenzo,
I'm not sure if you are using harbour of xharbour. If harbour you might want to have a look at contribs\hbwin. The olesrv*.prg present there are both easy to understand and useful, as is the service.prg. Although I've stopped using it now, for a number of years I used just such an harbour OLE server to expose hbnetio to be called and used from xharbour programs (VxH) where I needed this functionality. The contrib/hbwin folder contains examples to call from javascript, .vbs.
Just a suggestion.
Robb
I'm not sure if you are using harbour of xharbour. If harbour you might want to have a look at contribs\hbwin. The olesrv*.prg present there are both easy to understand and useful, as is the service.prg. Although I've stopped using it now, for a number of years I used just such an harbour OLE server to expose hbnetio to be called and used from xharbour programs (VxH) where I needed this functionality. The contrib/hbwin folder contains examples to call from javascript, .vbs.
Just a suggestion.
Robb
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: fivewin/Harbour encrypt decrypt function in c#
Lorenzo,
You can create a Windows DLL and use it from your .NET app.
Thats what I did in FiveNet:
https://code.google.com/p/fivenet/wiki/architecture
You can create a Windows DLL and use it from your .NET app.
Thats what I did in FiveNet:
https://code.google.com/p/fivenet/wiki/architecture
-
- Posts: 28
- Joined: Mon Jun 29, 2015 7:41 am
Re: fivewin/Harbour encrypt decrypt function in c#
Actually i found that, it is possible to run an xHarbour/fivewin exe from c# net with no problems, if i do not define any Window ,
that is, running a dos executable, without desktop implications.
Now i would try your suggestion that seems VERY interesting.
In effect this would eliminate the "problem" to read the code, without obfuscation, that is a more secure one.
Thanks Antonio
that is, running a dos executable, without desktop implications.
Now i would try your suggestion that seems VERY interesting.
In effect this would eliminate the "problem" to read the code, without obfuscation, that is a more secure one.
Thanks Antonio
-
- Posts: 28
- Joined: Mon Jun 29, 2015 7:41 am
Re: fivewin/Harbour encrypt decrypt function in c#
Ok Antonio, many of us made thousands of lines of marvellous code with fivewin, trhrough decades , thanks to your tremendous work.
Now, all is web and html and .net, so, what an incredible step over, would be to use our old but overtested fivewin algorythm in .Net !
Now, i was able to use all my old fivewin code from visualstudio .net project, by simply calling (running) my exe without activate ANY window.
That is, no need to change my code; simply i do not Activate any window.
This way i can maintain reference to main ownd and owndclient window without changing a line of code
and write the output i need, into a file that i can then read from c# .net.
I then tried to look at your fivenet project that seems to allow to run a windowed exe from net.
So, i registered with
c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm fivenet.dll /tlb
and also with
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm fivenet.dll /tlb
then from my c# net project i tried to run one of your exe (tutor01.exe) with
scriptProc.StartInfo.FileName = @"tutor01.exe";
scriptProc.Start();
scriptProc.WaitForExit();
but i have no message prompt and no error from .net
Sorry if i post here referring to fivenet, but as i understand better the architecture i will post in fivenet forum.
Thanks
Now, all is web and html and .net, so, what an incredible step over, would be to use our old but overtested fivewin algorythm in .Net !
Now, i was able to use all my old fivewin code from visualstudio .net project, by simply calling (running) my exe without activate ANY window.
That is, no need to change my code; simply i do not Activate any window.
This way i can maintain reference to main ownd and owndclient window without changing a line of code
and write the output i need, into a file that i can then read from c# .net.
I then tried to look at your fivenet project that seems to allow to run a windowed exe from net.
So, i registered with
c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm fivenet.dll /tlb
and also with
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm fivenet.dll /tlb
then from my c# net project i tried to run one of your exe (tutor01.exe) with
scriptProc.StartInfo.FileName = @"tutor01.exe";
scriptProc.Start();
scriptProc.WaitForExit();
but i have no message prompt and no error from .net
Sorry if i post here referring to fivenet, but as i understand better the architecture i will post in fivenet forum.
Thanks
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: fivewin/Harbour encrypt decrypt function in c#
Lorenzo,
If you directly run tutor01.exe, does it work ?
If you directly run tutor01.exe, does it work ?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: fivewin/Harbour encrypt decrypt function in c#
I just realized why it is not working from your C# app:
I use GetModuleFileName( NULL, ... ) to access the root app (tutor01.exe) and it you start tutor01.exe
from your C# app, then tutor01.exe is not the root app anymore
I use GetModuleFileName( NULL, ... ) to access the root app (tutor01.exe) and it you start tutor01.exe
from your C# app, then tutor01.exe is not the root app anymore
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: fivewin/Harbour encrypt decrypt function in c#
We could replace:
GetModuleFileName( NULL, ... )
with:
GetModuleFileName( GetModuleHandle( "tutor01.exe" ), ... )
and that should solve the problem
GetModuleFileName( NULL, ... )
with:
GetModuleFileName( GetModuleHandle( "tutor01.exe" ), ... )
and that should solve the problem
-
- Posts: 28
- Joined: Mon Jun 29, 2015 7:41 am
Re: fivewin/Harbour encrypt decrypt function in c#
Antonio,
answering to you first question, if i can run tutor01.exe directly (by double-clicking on it):
Not, or anyway i cannot see any messagebox appearing, nor any error!
And, by the way, how can i run tutor01.exe from c# web application if not by running it as an externalk process?
There is another o better way?
thanks
Lorenzo
answering to you first question, if i can run tutor01.exe directly (by double-clicking on it):
Not, or anyway i cannot see any messagebox appearing, nor any error!
And, by the way, how can i run tutor01.exe from c# web application if not by running it as an externalk process?
There is another o better way?
thanks
Lorenzo
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: fivewin/Harbour encrypt decrypt function in c#
tutor01.exe should work fine on your pc.
I don't think that you can use Windows GUI when executing an EXE from web .NET code
Is it possible to do it with C# ? Can you build a tutor01.exe with C# and call it from your web code ?
I don't think that you can use Windows GUI when executing an EXE from web .NET code
Is it possible to do it with C# ? Can you build a tutor01.exe with C# and call it from your web code ?
-
- Posts: 28
- Joined: Mon Jun 29, 2015 7:41 am
Re: fivewin/Harbour encrypt decrypt function in c#
No, Antonio,
tutor01.exe (that should be ....a simple message to show)
does nothinìg if i run directly on my windows 10 pc. It runs and exit without showing any message.
---------------------------------------------------------------------------------------------------------------------
Anyway my intent was to be able to run fivewin window's exe on the web from a web c# .net site.
Seems that this is impossible (something is possible with "net remoting" but it is not what i want.
Instead, as i can safely run my fivewin executable, (without Activating any window from it), i can comunicate with the exe through xml or txt files.
tutor01.exe (that should be ....a simple message to show)
Code: Select all
/ FiveNet - simple message
function Main()
MsgInfo( "Welcome to FiveNet" )
return nil
---------------------------------------------------------------------------------------------------------------------
Anyway my intent was to be able to run fivewin window's exe on the web from a web c# .net site.
Seems that this is impossible (something is possible with "net remoting" but it is not what i want.
Instead, as i can safely run my fivewin executable, (without Activating any window from it), i can comunicate with the exe through xml or txt files.