Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (EternallyCurious, AndrewAMD, TipmyPip, Quad), 889 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Re: ftp_download [Re: WretchedSid] #451000
04/26/15 22:37
04/26/15 22:37
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Oh how I wish I had your knowledge written in one book... or a few. Either way grin

Anyway, This really helped me. I now know to stay away from FTP and SFTP then, because one of those would have been my original method... I was trying to find a tutorial on how to set up sftp into a dll actually.


So, I'm gunna take all your keywords and google them up.
I'm currently looking into how to just create a dll to do anything with 3dgs -- like litterally anything at all. Start small and build on from there.

I can program with php (to some extent -- like I can build a basic forum if I wanted) So I think that should be sufficient knowledge for that end of programming, right? Also need to look into making a self signed certificate... Tons to look into....

Cheers Sid,
You Rock!




Once again, any tutorial that leads me in the right direction will be cool laugh

Edit: Which VC++ version should I have installed?

Last edited by DLively; 04/26/15 22:54. Reason: another question added

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: ftp_download [Re: DLively] #451003
04/27/15 00:15
04/27/15 00:15
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: DLively
Edit: Which VC++ version should I have installed?

I'm going to lean myself out of the metaphorical window here, but I think you can choose whichever you want as long as you stay away from the engine SDK. If you stick to a C interface, and it's not like you actually have a choice here, the produced DLL should be ABI compatible with Lite-C.

The basic idea of a DLL is that you have code compiled into a different binary that is loaded at runtime and then linked at runtime. Normally when you write a function in Lite-C and then later call it, the target address is resolved when you compile your application. The difference with a DLL is that the target address is resolved at runtime, which means you have to import the functions from the DLL which will tell the compiler that the function does actually exist and is okay to call, it just is not visible yet, but it also puts an entry into your binary so the dynamic linker can load the DLL and resolve the targets for you at runtime.

Let's say your DLL exports a function called foobar which takes an int, you would then declare the function on the Lite-C side like this:

Code:
void foobar(int bar);
#define PRAGMA_API foobar;myDLL!foobar



You can also rename the function if you would like, the first part of PRAGMA_API is the identifier of the function in Lite-C, then comes the name of your DLL and then comes the identifier of the exported function.

Your callsites don't change, it still looks like this
Code:
foobar(42); // Call into the DLL



Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: ftp_download [Re: WretchedSid] #451004
04/27/15 01:19
04/27/15 01:19
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Code:
#ifndef ACKNET_H
#define ACKNET_H

#define PRAGMA_BIND "acknet.dll";

var http_proxy(char* proxy,var port);

var http_sendpost(char* url, char* data);

var http_status(var httpid);

var http_result(var httpid, STRING* result);

var http_free(var httpid);


var ftp_download(char* url, char* path, char* username, char* password);

var ftp_upload(char* url, char* path, char* username, char* password);

var ftp_getdate(char* url, char* username, char* password);

void ftp_stop();

long ftp_size();

long ftp_sent();

long ftp_timestamp();

var ftp_status();

var ftp_debug(var mode);

#endif



I was Basing my original idea of how things are constructed with the above code. Is the dll I create being declared differently than this one?


I just dont understand how to put stuff into my dll.. I looked up a tutorial and came up with this:

.cpp file
Code:
#include <iostream>
using namespace std;
#include "SimpleHeader.h"

namespace nmspace
{
	void myclass::Crap()
	{
		cout << "I'm called within a crappy DLL!";
	}
}



and a dot.h file
Code:
namespace nmspace
{
	class myclass
	{
	public:
		static __declspec(dllexport) void Crap();
	};
}



I then built this and now have a dll (SimpleDll.dll).. how can I use it in 3dgs, so it displays that message?(as a test)


EDIT:
Inside header file mydll.h

void Crap();
#define PRAGMA_API Crap;SimpleDll!Crap

I tried the above, but it said that it can't find crap.. But it initialized the dll grin


Last edited by DLively; 04/27/15 01:44.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: ftp_download [Re: DLively] #451010
04/27/15 02:12
04/27/15 02:12
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
You are exporting a C++ function, which is subject to name mangling. You want to export a C function which is not subject to name mangling. You can either do that by wrapping your class (which is totally useless as is by the way), or by not even doing that to begin with.

Your cpp file:
Code:
#include <iostream>

extern "C" __declspec(dllexport) void Crap();

void Crap()
{
   std::cout << "Hello world" << std::endl;
}



Please, since you are starting to touch C++, never even start getting used to "using namespace xyz", since it defeats all purposes namespaces have. Also note that "cout" will write to stdout (which in its normal form doesn't even exist on Windows), and you won't see the output of it ever. If you just want to know wether it works, maybe try this:

Code:
#include <iostream>

extern "C" __declspec(dllexport) int FancyMultiply(int a, int b);

int FancyMultiply(int a, int b)
{
   return a * b;
}




Lite-C
Code:
int FancyMultiply(int a, int b);
#define PRAGMA_API FancyMultiply;SimpleDll!FancyMultiply

void main()
{
   printf("8 * 24 = %d", FancyMultiply(8, 24)); 
}



Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: ftp_download [Re: WretchedSid] #451014
04/27/15 02:33
04/27/15 02:33
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Okay, things are starting to come together in my head now.. Roads are being mapped out grin

Though, When I try to use the new dll, 3dgs_dll, It doesn't show up in the compiler -- But I don't get an error or empty function error message so its working to some degree.. will it, or should it appear in the compiler?

This doesn't seem to work for me smirk

Code:
printf("8 * 24 = %d", FancyMultiply(8, 24));



I only get the first half of the printf (the string)




also i tried this:

Code:
DEBUG_VAR(FancyMultiply(8, 24), 100);





EDIT:

NVM. I forgot the fucking while loop around the DEBUG_VAR... IT WORKS!!!!! grin grin grin

OMG! Thank you sooo much Sid, You fucking rock laugh laugh laugh laugh laugh laugh laugh


Quote:

HTTPS does not require credentials that you have to put in the DLL, but HTTPS provides you with means to be sure that data is not tampered with. And, again, use certificate pinning to pin the server certificate. Otherwise, if you just accept any valid certificate, you are still suspicable to man in the middle attacks. And of course on the plus side, since you are no longer relying on the chain of trust to trust your server, you can use a self signed certificate which saves you a couple of bucks.


Any tips on where to start with this? laugh

would you recomend this: http://www.akadia.com/services/ssh_test_certificate.html

Last edited by DLively; 04/27/15 04:52.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: ftp_download [Re: DLively] #451046
04/27/15 18:18
04/27/15 18:18
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
A certificate can be generated with openssl. If you have a local Apache running, chances are high, you already have it somewhere.

I used the very same tutorial some months ago and it worked fine.

Just do this step by step. No need to really understand anything of this for now. In the end you will have your own certificate, and if you setup your webserver to use it, wou'll get a warning because it's not registered. But this will be fine for your use.

Re: ftp_download [Re: FBL] #451052
04/27/15 22:25
04/27/15 22:25
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Firoball
In the end you will have your own certificate, and if you setup your webserver to use it, wou'll get a warning because it's not registered.


It's not because it's not registered but because no sane browser will trust it. Certificates rely on trust, which means that your browser and OS have a couple of certificates they trust, these are called root certificates. Now, normally you get a certificate from a CA (certificate authority) which either has one of these root certificates or a certificate that is signed by a root certificate, they will sign your certificate with their certificate. In the end, you will end up with a chain of trust. Your browser will trust your certificate because it trusts who signed it, or it trusts who signed their certificate, or who signed their certificate. In theory it can be arbitrary long, but for example if you receive a certificate from a CA it won't have the right to sign other certificates.

The idea behind this is that no one can run around and just generate a certificate for let's say google.com. Google has a certificate which was signed by the Google Internet Authority G2, which is an intermediate CA. Their certificate comes from GeoTrust, one of the largest root CAs. If you want a regular certificate, you will have to prove to the CA that you own the domain, only then they will issue you a certificate (and take quite a buck for it).

Now, all this is well and good, the only issue is that is a huge clusterfuck since it relies on trust and trust alone. If you break into a CA and steal their certificate, you can generate your own valid certificate for google.com. So the idea is to limit the amount of CAs that are trusted, but for example both Windows and OS X ship trusting the chinese government and various intelligence agencies who may or may not have an interest in creating fake certificates so your browser trusts their man in the middle attack. Of course, if you were to actually break into a CA, you can be damn sure that their certificate would be revoked and you may actually end up achieving getting their certificate kicked out of the trust store of browsers and operating systems

And this finally is where certificate pinning comes into play. Certificate pinning means that you know what certificate the other end has, and when the server presents you their certificate, instead of just using the chain of trust to verify that the certificate is legit, you also check wether the certificate is the one you would expect it to be. Google does that in Chrome with google.com domains and a couple of others (in fact, there is a registry for that, where companies can register their certificates). If you visit google.com and someone in the middle presents a certificate that is valid but not the correct one, Chrome will give you a warning.

Of course, this is perfect for you! You don't want to rely on trust, because then you would also need to sleep with a CA, you know exactly what server you expect to see and how the certificate will look like. So, you pin it. Doesn't matter if a browser doesn't trust it, all that matters is that you trust it.

How to implement that... Well, since I'm far from being a Windows developer and haven't seriously touched a Windows machine in ages, I have no idea whatsoever. But I would be surprised if C# wouldn't have high level constructs for doing that and I would also be surprised if there wasn't a way to write a C wrapper over that.


Edit: Also, looking at your printf, it already looked like it was working fine? That was exactly the output to expect, or am I missing something?

Last edited by WretchedSid; 04/27/15 22:31.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: ftp_download [Re: WretchedSid] #451067
04/28/15 09:37
04/28/15 09:37
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Okay thanks Firo, I'll look into that for sure then laugh

Hmm.. So what If I just bought a cheap ssl cert from a CA that offers them for say 5 dollars yearly - would that be sufficient?

What If I have people going to my website on a daily basis? they will get a trust warning wont they? That is if I create my own ssl cert.

I appreciate all the info and help you've given me to this point, I'll gladly read more grin
You must laugh at us windows users, huh SID? tongue
But seriously, Im gunna dig deep into things. I found lots of information about it in the manual laugh I read every single entry in that damn thing today... Very good read grin Gunna have to do it again soon.

Also, the printf actually does work, but Im still learning -- so mistakes are imminent laugh

Last edited by DLively; 04/28/15 09:37.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: ftp_download [Re: DLively] #451118
04/28/15 19:09
04/28/15 19:09
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
The warning is just if you try this with your webserver and access with a regular browser. I wrote that part too short tongue

However I think Google has an answer for sure. (1st shot: http://stackoverflow.com/questions/25125165/certificate-pinning-with-winhttp-api ...whatever winhttp is, it sounds possibly useful)

Re: ftp_download [Re: FBL] #451129
04/28/15 21:28
04/28/15 21:28
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I have a website devonlively.com that I want people to visit -- If I they view my website in a regular browser they will get the error message, right?

Thank you for that link, Firo! I skimmed the question and it appears that will take me to the next step with this (hopefully)

Thanks a lot laugh
Ps. I keep seeing your avatar and wanted to mention that Super Ghost and Ghouls was a favorite SNES game of my childhood too laugh


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Page 3 of 4 1 2 3 4

Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1