Don't connect server!!!

06/04/2013 06:41 oiakrap#1
hi guys, I don't know if error is Login or Game. look how I do...

I tried so...

GameServer Main.cpp
Code:
#include "headers.h"
#include "Header.h"
#include "xD.h"

#include "mysql.h"

// Winsock for our network communication
#include <winsock2.h>
#include <iostream>

using namespace std;

int StartServerListening(unsigned short port);

void EndServer(int socket);

HANDLE Hthread; // Used to handle our threads
HANDLE Hmutex; // A mutex is bascially a memory spot we can lock so nothing writes to it as we read form it.. That could cause issues

FD_SET masterSet; // This basically is our list of sockets that we will lock and unlock with out mutexHandle

// A FD_SET has a few data members:
// - fd_count - the number of file descriptors in the set
// - fd_array - the array of file descriptors

// We can use these little macros to help edit the FD_SET
// - FD_SET(a socket, FD_SET to manipulate) - add a scoket to the set
// - FD_ZERO(FD_SET to manipulate) - zero a set
// - FD_CLR(a socket, FD_SET to manipulate) - remove a socket from the set
// - FD_ISSET(a socket, FD_SET to manipulate) - checks if the socket is already in the set


bool gQuitFlag = false;// A flag ill use to terminate the program if it goes terribly wrong

// AcceptThread() - a This function will accept ALL incomming connections Then add to the FD_SET list
void AcceptThread(int* serverSocket)
{
    int mySocket = *serverSocket;    // Copy my socket over to a local variable

    
    for (;;)// Run forever, why stop? O_o
    {
    
        unsigned int clientSocket = accept(mySocket, 0, 0);    // Do a normal accept

        if (clientSocket == SOCKET_ERROR)
        {
            cout << "Server: I shall not accept them!\n";
            gQuitFlag = true; // Quit this thread
            return;
        }
        else
        {
            WaitForSingleObject(Hmutex, INFINITE);// Lock the mutex and wait for it
            FD_SET(clientSocket, &masterSet);// Add this socket to the master set using FD_SET()
            ReleaseMutex(Hmutex);// Unlock the mutex

            
            cout << "client on " << clientSocket <<" connected.\n" << endl;// Let everyone know someone just joined
        }
    }
}

int main()
{
	std::cout << "##################NostaleExtremeX - Game Server######################" << std::endl;
	std::cout << "#   NostaleExtremeX version Beta                                    #" << std::endl;
    std::cout << "#                 IP: 127.0.0.1                                     #" << std::endl;
    std::cout << "#                 Port: 1337                                        #" << std::endl;
    std::cout << "#                                 NEX - Private Server of Nostale   #" << std::endl;
	std::cout << "#   NosPrivate                                                      #" << std::endl;
	std::cout << "##################NostaleExtremeX - Game Server######################" << std::endl;
    cout << "Server: Congratulations!\n";
    cout << "Server: Server Online\n\n";

    int serverSocket;
    serverSocket = StartServerListening(1337);

    if (serverSocket == -1)
    {
        cout << "Server: I failed you master! Im so ashamed!\n";
        return 1;
    }

    
    Hmutex = CreateMutex(NULL, false, NULL);// Create the mutex

    if (Hmutex == NULL)
    {
        cout << "Server: Sorry Sir! Could not make our Mutex! FORGIVE ME!\n";
        EndServer(serverSocket);
        return 1;
    }

    
    int thread;// Create the thread
    Hthread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AcceptThread, &serverSocket, 0, (LPDWORD)&thread);
    
    if (Hthread == NULL)
    {
        cout << "Server: SORRY SIR! Could not beging Accepting!\n";
        EndServer(serverSocket);
        return 1;
    }
    Sleep(100);// Let the AcceptThread start up, cheap method, but oh well -.-;

    FD_ZERO(&masterSet); // Always zero your sets before you use them, you know.. just incase...

    for (;;) // Forever!!!!
    {
        if (gQuitFlag)
        {
            break;
        }


        WaitForSingleObject(Hmutex, INFINITE);        // Lock the mutex

        FD_SET TempSet = masterSet; // Make a temp location so we can unlock our mutex and let our accept thread run ASAP
        ReleaseMutex(Hmutex);        // Unlock the mutex

        if (TempSet.fd_count == 0) // If a set is empty and we call form it, it returns a error, thats too much coding for me
        {                              // So we will simply check if there is anything in it, if so we will do something, else screw it -.-;
            continue;
        }

        // select() has 5 member datas of use to us they are
        // - the number of file descriptors
        // - a FD_SET  checks readability
        // - a FD_SET  checks for writeability
        // - a FD_SET  checks for errors
        // - a wait time
        timeval waitTime; // Set up our interval
        waitTime.tv_sec = 0; // Set it to 0
        waitTime.tv_usec = 0; // Set it to 0

        int result = select(TempSet.fd_count, &TempSet, NULL, NULL, &waitTime); // Select a socket in out TempSet


        if (result == 0) // Check for 0's agian
        {
            continue; // = Empty
        }

        if (result == SOCKET_ERROR)
        {
            cout << "Server: Sorry Sir! there was a error in the Select() macro!\n";
            continue;
        }

        for (unsigned int i = 0; i < TempSet.fd_count; i++)
        {
            unsigned int clientSocket = TempSet.fd_array[i];

            int nBytes;
            #define MAX_MESSAGE_SIZE 4096
            char buffer[MAX_MESSAGE_SIZE];

            unsigned long messageSize;
            nBytes = recv(clientSocket, (char*)&messageSize, sizeof(messageSize), 0);

            if (nBytes == SOCKET_ERROR)
            {
                int error = WSAGetLastError();// Main error you will get here is if the other client suddenly disconnects or loses power or something similar
                if (error == WSAECONNRESET)
                {
                    WaitForSingleObject(Hmutex, INFINITE);    // Lock our mutex
                    FD_CLR(clientSocket, &masterSet);            // Remove the socket from our master set
                    ReleaseMutex(Hmutex);                    // Unlock our mutex
                    closesocket(clientSocket);                    // Close the socket on our side so our computer cleans up properly
                    cout << "Server: Client on "<< clientSocket << " has Disconnected." << endl; // Tell everyone the person left
                    continue;
                }
                else
                {
                    cout << "Server: Sorry Sir... Its a fatel wound.. Oh god it hurts... *Breaths slowly* *Stops breathing*\n";// Error we wernt expecting, terminate the server in this case
                    gQuitFlag = true;
                    break;
                }
            }
            if (nBytes == 0) // Called if the user exits and calls closesocket() on THEIR side. They stops ending data, thus 0 bytes, ets jsut remove them from the set
            {
                WaitForSingleObject(Hmutex, INFINITE);    // Lock our mutex
                FD_CLR(clientSocket, &masterSet);        // Remove the socket from our master set
                ReleaseMutex(Hmutex);                // Unlock our mutex
                closesocket(clientSocket);                // Close the socket on our side, so our computer cleans up properly
                cout << "Server: Client on " << clientSocket << " has disconnected" << "\n";// Quick Message to the rest in the room
                continue;// On to the next one!
            }
            messageSize = ntohl(messageSize);
            nBytes = recv(clientSocket, buffer, messageSize, 0);
            if (nBytes == SOCKET_ERROR)
            {
                cout << "Server: I failed the message sir!\n";
                gQuitFlag = true;
                break;
            }
            buffer[messageSize] = 'xD';
            cout << "Server: Client [" <<  clientSocket << "]: " << buffer << "\n";
        }
    }

    EndServer(serverSocket);
    cout << "Server: Press any key to shut me down....\n";
    getchar();
    return 0;
}


int StartServerListening(unsigned short port)
{
    int error;
    WSAData wsaData;
    if ((error = WSAStartup(MAKEWORD(2, 2), &wsaData)) == SOCKET_ERROR)
    {
        cout << "Server: Winsock is being a bitch Sir!\n";
        return -1;
    }
    int mySocket = socket(AF_INET, SOCK_STREAM, 0);
    if (mySocket == SOCKET_ERROR)
    {
        cout << "Server: ****ing Socket is stuck closed!\n";
        return -1;
    }
    struct sockaddr_in server;
	server.sin_addr.s_addr = inet_addr("127.0.0.1");
    server.sin_family = AF_INET;
	server.sin_port = htons(port);
    server.sin_addr.s_addr = INADDR_ANY;
    if (bind(mySocket, (sockaddr*)&server, sizeof(server)) == SOCKET_ERROR)
    {
        cout << "Server: Sorry Sir! My Bind Failed!\n";
        closesocket(mySocket);
        return -1;
    }
    if (listen(mySocket, 5) == SOCKET_ERROR)
    {
        cout << "Server: I failed to listen -.-;\n";
        closesocket(mySocket);
        return -1;
    }
    cout << "Server: Starting Up.. READY!\n";
    return mySocket;
}
void EndServer(int socket)
{
    WaitForSingleObject(Hthread, INFINITE);// Kill thread and handle
    CloseHandle(Hthread);
    CloseHandle(Hmutex);
    closesocket(socket);
    WSACleanup();
    cout << "Server: Shuting down master.\n";
}

int _tmain(int argc, _TCHAR* argv[])
{
			 MYSQL *nosdb;
if ((nosdb = mysql_init (NULL)) == NULL) {
cout << " CRITICAL ERROR: Can't start mysql" << endl;
getchar();
exit(1);
}else{
if(!mysql_real_connect(nosdb, "127.0.0.1" ,"root", "1009" ,"nostalexD", 3306, 0,0))
{cout << " CRITICAL ERROR: Can't connect to DB" << endl;
getchar();
exit(1);}
else
{cout << "Service MySQL Started" << endl;}
}
MYSQL_ROW mrow;
MYSQL_RES *mres;
}

GameServer headers.h
Code:
#pragma comment(lib, "Ws2_32.lib") 

// Define 
#define MAX_SOCKET 10
#define RECV_BUFFER 512 

// Includes 
#include <iostream>
#include <WinSock2.h>
#include <Windows.h>
#include <vector>
#include <sstream>

using namespace std; 

int WsaStart(void); // Simpel WSA-Start Function 
std::string DecryptSessionPacket(std::string str); // Decrypt Session Function  
std::vector<std::string> split( std::string str, char delimiter ); // Split Function
std::string DecryptGamePacket2(unsigned char str[]); // DecryptGame2 Function 
std::string DecryptGamePacket(int session_id, unsigned char *str, int length); // DecryptGame Function 

std::string DecryptSessionPacket(std::string str)
{
    std::string    encrypted_string;

    for (int i = 1; i < str.length(); i++)
    {
                if (str[i] == 0xE) { return encrypted_string; }

        unsigned char firstbyte = str[i] - 0xF;
        unsigned char secondbyte = firstbyte;
        secondbyte &= 0xF0;
        firstbyte =    firstbyte - secondbyte;
        secondbyte >>=    0x4;

        switch (secondbyte)
        {
        case 0:
            encrypted_string +=    ' ';
        break;

        case 1:
            encrypted_string +=    ' ';
        break;

        case 2:
            encrypted_string +=    '-';
        break;

        case 3:
            encrypted_string +=    '.';
        break;

        default:
            secondbyte += 0x2C;
            encrypted_string +=    secondbyte;
        break;
        }

        switch (firstbyte)
        {
        case 0:
            encrypted_string +=    '\0';
        break;

        case 1:
            encrypted_string += ' ';
        break;

        case 2:
            encrypted_string += '-';
        break;

        case 3:
            encrypted_string += '.';
        break;

        default:
            firstbyte += 0x2C;
            encrypted_string +=    firstbyte;
        break;
        }
    }

    return encrypted_string;
}
std::vector<std::string> split( std::string str, char delimiter )
{
    std::vector<std::string> ret;

    size_t pos = str.find_first_of( delimiter );

    while ( !str.empty() )
    {
        std::string cur = str.substr( 0, pos );
        if ( !cur.empty() )
            ret.push_back( cur );

        if ( pos == std::string::npos )
            break;

        str = str.substr( pos + 1 );

        pos = str.find_first_of( delimiter );
    }

    return ret;
}    
std::string DecryptGamePacket2(unsigned char str[])
{
    std::string decrypted_string;
    char table[] = {' ','-','.','0','1','2','3','4','5','6','7','8','9','n'};
    int count = 0;

    for (count = 0; count < strlen((const char*)str); )
    {
        if (str[count] <= 0x7A)
        {
            unsigned char len = str[count];

            for (int i = 0; i < (int)len; i++)
            {
                count++;
                decrypted_string += str[count] ^ 0xFF;
            }

            count++;
        } else
        {
            unsigned char len = str[count];
            len &= 0x7F;

            for (int i = 0; i < (int)len;)
            {
                count++;

                unsigned char highbyte = str[count];
                highbyte &= 0xF0;
                highbyte >>= 0x4;

                unsigned char lowbyte = str[count];
                lowbyte &= 0x0F;

                if (highbyte != 0x0 && highbyte != 0xF)
                {
                    decrypted_string += table[highbyte-1];
                    i++;
                }

                if (lowbyte != 0x0 && lowbyte != 0xF)
                {
                    decrypted_string += table[lowbyte-1];
                    i++;
                }
            }
            count ++;
        }
    }

    return decrypted_string;
}
std::string DecryptGamePacket(int session_id, unsigned char *str, int length)
{
    std::string encrypted_string = "";
    int session_key = session_id & 0xFF;
    unsigned char session_number = session_id >> 6;
    session_number &= 0xFF;
    session_number &= 0x80000003;

    switch (session_number)
    {
    case 0:
        for (int i = 0; i < length; i++)
        {
                unsigned char firstbyte = session_key + 0x40;
                unsigned char highbyte = str[i] - firstbyte;
                encrypted_string += highbyte;
        }
    break;

    case 1:
        for (int i = 0; i < length; i++)
        {
                unsigned char firstbyte = session_key + 0x40;
                unsigned char highbyte = str[i] + firstbyte;
                encrypted_string += highbyte;
        }
    break;

    case 2:
        for (int i = 0; i < length; i++)
        {
                unsigned char firstbyte = session_key + 0x40;
                unsigned char highbyte = str[i] - firstbyte ^ 0xC3;
                encrypted_string += highbyte;
        }
    break;

    case 3:
        for (int i = 0; i < length; i++)
        {
                unsigned char firstbyte = session_key + 0x40;
                unsigned char highbyte = str[i] + firstbyte ^ 0xC3;
                encrypted_string += highbyte;
        }
    break;

    default:
        encrypted_string += 0xF;
    break;
    }

    std::vector<std::string> temp = split(encrypted_string, 0xFF);
    std::string save;

    for (int i = 0; i < temp.size(); i++)
    {
        save += DecryptGamePacket2((unsigned char*) temp[i].c_str());
        save += 0xFF;
    }

    return save;
}
GameServer Header.h
Code:
#include <windows.h>
#include <tchar.h> 
#include <stdio.h>
#include <strsafe.h>
#pragma comment(lib, "User32.lib")

void DisplayErrorBox(LPTSTR lpszFunction);

int _main(int argc, TCHAR *argv[])
{
   WIN32_FIND_DATA ffd;
   LARGE_INTEGER filesize;
   TCHAR szDir[MAX_PATH];
   size_t length_of_arg;
   HANDLE hFind = INVALID_HANDLE_VALUE;
   DWORD dwError=0;
   
   // If the directory is not specified as a command-line argument,
   // print usage.

   if(argc != 2)
   {
      _tprintf(TEXT("\nUsage: %s <directory name>\n"), argv[0]);
      return (-1);
   }

   // Check that the input path plus 3 is not longer than MAX_PATH.
   // Three characters are for the "\*" plus NULL appended below.

   StringCchLength(argv[1], MAX_PATH, &length_of_arg);

   if (length_of_arg > (MAX_PATH - 3))
   {
      _tprintf(TEXT("\nDirectory path is too long.\n"));
      return (-1);
   }

   _tprintf(TEXT("\nTarget directory is %s\n\n"), argv[1]);

   // Prepare string for use with FindFile functions.  First, copy the
   // string to a buffer, then append '\*' to the directory name.

   StringCchCopy(szDir, MAX_PATH, argv[1]);
   StringCchCat(szDir, MAX_PATH, TEXT("\config\server.ini"));

   StringCchCopy(szDir, MAX_PATH, argv[1]);
   StringCchCat(szDir, MAX_PATH, TEXT("\data\*"));

   StringCchCopy(szDir, MAX_PATH, argv[1]);
   StringCchCat(szDir, MAX_PATH, TEXT("\maps\zones\*"));

   // Find the first file in the directory.

   hFind = FindFirstFile(szDir, &ffd);

   if (INVALID_HANDLE_VALUE == hFind) 
   {
      DisplayErrorBox(TEXT("FindFirstFile"));
      return dwError;
   } 
   
   // List all the files in the directory with some info about them.

   do
   {
      if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
      {
         _tprintf(TEXT("  %s   <DIR>\n"), ffd.cFileName);
      }
      else
      {
         filesize.LowPart = ffd.nFileSizeLow;
         filesize.HighPart = ffd.nFileSizeHigh;
         _tprintf(TEXT("  %s   %ld bytes\n"), ffd.cFileName, filesize.QuadPart);
      }
   }
   while (FindNextFile(hFind, &ffd) != 0);
 
   dwError = GetLastError();
   if (dwError != ERROR_NO_MORE_FILES) 
   {
      DisplayErrorBox(TEXT("FindFirstFile"));
   }

   FindClose(hFind);
   return dwError;
}


void DisplayErrorBox(LPTSTR lpszFunction) 
{ 
    // Retrieve the system error message for the last-error code

    LPVOID lpMsgBuf;
    LPVOID lpDisplayBuf;
    DWORD dw = GetLastError(); 

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
        FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL,
        dw,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR) &lpMsgBuf,
        0, NULL );

    // Display the error message and clean up

    lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, 
        (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR)); 
    StringCchPrintf((LPTSTR)lpDisplayBuf, 
        LocalSize(lpDisplayBuf) / sizeof(TCHAR),
        TEXT("%s failed with error %d: %s"), 
        lpszFunction, dw, lpMsgBuf); 
    MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK); 

    LocalFree(lpMsgBuf);
    LocalFree(lpDisplayBuf);
}

what changes in the login is that...

Code:
#pragma comment(lib, "Ws2_32.lib") 

// Includes 
#include <iostream>
#include <WinSock2.h>
#include <Windows.h>
#include <vector>
#include <sstream>
#include <tchar.h>

using namespace std; 


std::string DecryptLoginPacket(std::string str, int plength)
{
	std::string decrypted_string;

	for (int i = 0; i < plength; i++) { decrypted_string += str[i] - 0xF ^ 0xC3; }

	return decrypted_string;
}

std::string EncryptLoginPacket(std::string str)
{
	std::string encrypted_string;

	for (int i = 0; i < str.length(); i++) { encrypted_string += str[i] + 0xF; }

	return encrypted_string += 0x19;
}

std::string GetPasswordString(std::string str)
{
	std::string decrypted_string;
	int count = 1;
	int convert;

	if (str.length() %2 == 0)
	{
		str.erase(0, 3);
	} else
	{
		str.erase(0, 4);
	}

	for (int i = 0; i < str.length(); i+=2)
	{
		decrypted_string += str[i];

		if (count %2 == 0)
		{
			decrypted_string += ' ';
		}
		count++;
	}

	std::stringstream ss(decrypted_string);
	decrypted_string.clear();

	while (ss >> std::hex >> convert)
	{
		decrypted_string.push_back(convert);
	}

	return decrypted_string;
}


std::string DecryptHashPassword(std::string str)
{
    std::string decrypted_string;
    int count = 1;
    int convert;

    if (str.length() %2 == 0)
    {
        str.erase(0, 3);
    } else
    {
        str.erase(0, 4);
    }

    for (int i = 0; i < str.length(); i+=2)
    {
        decrypted_string += str[i];

        if (count %2 == 0)
        {
            decrypted_string += ' ';
        }
        count++;
    }

    std::stringstream ss(decrypted_string);
    decrypted_string.clear();

    while (ss >> std::hex >> convert)
    {
        decrypted_string.push_back(convert);
    }

    return decrypted_string;
}
others I use is...

Login or Game... main.cpp...
Code:
#include "headers.h"

#include "mysql.h"

int _Wmain()
{
    std::cout << "##################NostaleExtremeX - Login Server#####################" << std::endl;
	std::cout << "#   NostaleExtremeX version Beta                                    #" << std::endl;
    std::cout << "#                 IP: 25.81.108.154                                 #" << std::endl;
    std::cout << "#                 Port: 4001                                        #" << std::endl;
    std::cout << "#                                 NEX - Private Server of Nostale   #" << std::endl;
	std::cout << "#   NosPrivate                                                      #" << std::endl;
    std::cout << "##################NostaleExtremeX - Login Server#####################" << std::endl;
    long answer;
    char recvbuf[255];
 
    WSAData wsaData;
    WORD DLLVERSION;
    DLLVERSION = MAKEWORD(2,1);
    answer = WSAStartup(DLLVERSION, &wsaData);
    SOCKADDR_IN addr;
    int addrlen = sizeof(addr);
    SOCKET sListen;
    SOCKET sConnect;
    sConnect = socket(AF_INET,SOCK_STREAM,0);
    addr.sin_addr.s_addr = inet_addr("25.81.108.154");
    addr.sin_family = AF_INET;
    addr.sin_port = htons(4001);
    sListen = socket(AF_INET, SOCK_STREAM,0);
    bind(sListen, (SOCKADDR*)&addr, sizeof(addr));
    listen(sListen, SOMAXCONN);
    int b = 0;
    for(;;){


         if(sConnect = accept(sListen, (SOCKADDR*)&addr, &addrlen))
         {
             std::cout << "Connection accepted from: "<< std::endl;
             answer = recv(sConnect, recvbuf,255,0); 
             std::cout << recvbuf << std::endl;

}
	
}

WSACleanup();
std::cin.get();
return 0;
}

		

int _tmain(int argc, _TCHAR* argv[])
{
			 MYSQL *nosdb;
if ((nosdb = mysql_init (NULL)) == NULL) {
cout << " CRITICAL ERROR: Can't start mysql" << endl;
getchar();
exit(1);
}else{
if(!mysql_real_connect(nosdb, "127.0.0.1" ,"root", "1009" ,"nostalexD", 3306, 0,0))
{cout << " CRITICAL ERROR: Can't connect to DB" << endl;
getchar();
exit(1);}
else
{cout << "Service MySQL Started" << endl;}
}
MYSQL_ROW mrow;
MYSQL_RES *mres;
}
ah... I think it will not connect database T.T
isn't blocked ports and program, because my firewall is off

plz help :)
06/04/2013 12:42 TheTempler#2
what is that for a login / game server from elektro or from Kingrap?
or use [Only registered and activated users can see links. Click Here To Register...] , [Only registered and activated users can see links. Click Here To Register...]
06/04/2013 21:05 Mr.Tr33#3
Quote:
Originally Posted by TheTempler View Post
what is that for a login / game server from elektro or from Kingrap?
or use [Only registered and activated users can see links. Click Here To Register...] , [Only registered and activated users can see links. Click Here To Register...]
Or maybe he is just smarter and is programming his own server? ...
06/04/2013 23:37 oiakrap#4
yes xD

this commands are good?

look...

Quote:
/* all commands for players and GM */
#define ED_cmNullCmd 1

#define ED_cmInsertChar 2
#define ED_cmBackTab 3
#define ED_cmPrevTabPos 3
#define ED_cmInsertSymbol 4
#define ED_cmTab 5
#define ED_cmBackspace 6
#define ED_cmDelete 7
#define ED_cmDeleteChar 8
#define ED_cmDeleteBlock 9
#define ED_cmDeleteWord 10
#define ED_cmDeleteToEOL 11
#define ED_cmDeleteToBOL 12
#define ED_cmDeleteLine 13
#define ED_cmDeleteWordBack 14
#define ED_cmNewLine 15
#define ED_cmInsertLine 16
#define ED_cmDupLine 17
#define ED_cmJoinLine 18
#define ED_cmCenterLine 19
#define ED_cmInsertComment 20
#define ED_cmInsertTimeDate 21
#define ED_cmInsertTime 22
#define ED_cmInsertDate 23
#define ED_cmInsertCommentLight 24
#define ED_cmDeleteBookmarkedLines 25

#define ED_cmCursorLeft 30
#define ED_cmCursorRight 31
#define ED_cmCursorUp 32
#define ED_cmCursorDown 33
#define ED_cmPageUp 34
#define ED_cmPageDown 35
#define ED_cmLineStart 36
#define ED_cmLineEnd 37
#define ED_cmWordLeft 38
#define ED_cmWordRight 39
#define ED_cmTextStart 40
#define ED_cmTextEnd 41
#define ED_cmTopOfWindow 42
#define ED_cmBottomOfWindow 43
#define ED_cmScrollUp 44
#define ED_cmScrollDown 45
#define ED_cmFirstNonBlank 46
#define ED_cmParaUp 47
#define ED_cmParaDown 48
#define ED_cmNextTabPos 49
#define ED_cmWordLeftMS 370
#define ED_cmWordRightMS 371
#define ED_cmWordLeftSmart 372
#define ED_cmWordRightSmart 373

#define ED_cmLeftSelect 50
#define ED_cmRightSelect 51
#define ED_cmUpSelect 52
#define ED_cmDownSelect 53
#define ED_cmPageUpSelect 54
#define ED_cmPageDownSelect 55
#define ED_cmLineStartSelect 56
#define ED_cmLineEndSelect 57
#define ED_cmWordLeftSelect 58
#define ED_cmWordRightSelect 59
#define ED_cmTextStartSelect 60
#define ED_cmTextEndSelect 61
#define ED_cmTopOfWindowSelect 62
#define ED_cmBottomOfWindowSelect 63
#define ED_cmParaUpSelect 64
#define ED_cmParaDownSelect 65
#define ED_cmPrevTabPosSelect 68
#define ED_cmNextTabPosSelect 69
#define ED_cmWordLeftMSSelect 380
#define ED_cmWordRightMSSelect 381
#define ED_cmWordLeftSmartSelect 382
#define ED_cmWordRightSmartSelect 383

#define ED_cmStartSelect 70
#define ED_cmEndSelect 71
#define ED_cmHideSelect 72
#define ED_cmSelectWord 73
#define ED_cmSelectLine 74
#define ED_cmSelectAll 75
#define ED_cmSelectPara 76
#define ED_cmSetCharSelMode 78
#define ED_cmSetColumnSelMode 79

#define ED_cmIndentBlock 80
#define ED_cmUnindentBlock 81
#define ED_cmFillBlock 82
#define ED_cmLeftBlockPara 86
#define ED_cmCenterBlockPara 87
#define ED_cmRightBlockPara 88
#define ED_cmJustifyBlockPara 89

#define ED_cmFind 90
#define ED_cmReplace 91
#define ED_cmFindNext 92
#define ED_cmGoToLine 93
#define ED_cmGoToColumn 94
#define ED_cmMatchPair 95
#define ED_cmFindNextWord 96
#define ED_cmFindPrevWord 97
#define ED_cmMatchPreprocNext 98
#define ED_cmMatchPreprocPrev 99
#define ED_cmFindParam 410
#define ED_cmFindParamC 411
#define ED_cmFindParamR 412
#define ED_cmFindInLineParam 413
#define ED_cmFindInLineParamC 414
#define ED_cmReplaceParam 415
#define ED_cmReplaceParamC 416
#define ED_cmReplaceParamR 417
#define ED_cmReplaceInLineParam 418
#define ED_cmReplaceInLineParamC 419
#define ED_cmFindParamCW 420
#define ED_cmReplaceParamCW 421
#define ED_cmFindInLineParamCW 423
#define ED_cmReplaceInLineParamCW 425
#define ED_cmFindInLineParamRCW 426
#define ED_cmReplaceInLineParamRCW 427
#define ED_cmFindParamRCW 428
#define ED_cmReplaceParamRCW 429
#define ED_cmFindInLineParamR 430
#define ED_cmMatchHtmlTag 431
#define ED_cmNextCompilerError 424
#define ED_cmPrevCompilerError 435
#define ED_cmGoToLineNum 436
#define ED_cmGoToColumnNum 437
#define ED_cmFindPrev 439

#define ED_cmSetMark0 100
#define ED_cmSetMark1 101
#define ED_cmSetMark2 102
#define ED_cmSetMark3 103
#define ED_cmSetMark4 104
#define ED_cmSetMark5 105
#define ED_cmSetMark6 106
#define ED_cmSetMark7 107
#define ED_cmSetMark8 108
#define ED_cmSetMark9 109
#define ED_cmGotoMark0 110
#define ED_cmGotoMark1 111
#define ED_cmGotoMark2 112
#define ED_cmGotoMark3 113
#define ED_cmGotoMark4 114
#define ED_cmGotoMark5 115
#define ED_cmGotoMark6 116
#define ED_cmGotoMark7 117
#define ED_cmGotoMark8 118
#define ED_cmGotoMark9 119
#define ED_cmBookmarkToggle 390
#define ED_cmBookmarkSet 391
#define ED_cmBookmarkClearAll 392
#define ED_cmBookmarkPrev 393
#define ED_cmBookmarkNext 394
#define ED_cmBookmarks 395
#define ED_cmSaveCursorPos 398
#define ED_cmRestoreCursorPos 399

#define ED_cmUndo 120
#define ED_cmRedo 121
#define ED_cmCut 123
#define ED_cmCopy 124
#define ED_cmPaste 125
#define ED_cmCutAndAppend 126
#define ED_cmCopyAndAppend 127
#define ED_cmCutLine 128
#define ED_cmCopyLine 129
#define ED_cmCutBookmarkedLines 400
#define ED_cmCopyBookmarkedLines 401

#define ED_cmUpperCase 130
#define ED_cmLowerCase 131
#define ED_cmFlipCase 132
#define ED_cmUpperCaseWord 133
#define ED_cmLowerCaseWord 134
#define ED_cmFlipCaseWord 135
#define ED_cmCapitalizeWord 136
#define ED_cmTitleCase 137
#define ED_cmSentenceCase 138

#define ED_cmTransposeChar 140
#define ED_cmTransposeWord 141
#define ED_cmTransposeLine 142

#define ED_cmToggleInsert 150
#define ED_cmToggleAutoIndent 151
#define ED_cmToggleAutoUnindent 152
#define ED_cmToggleWordWrap 155
#define ED_cmToggleRuler 157
#define ED_cmToggleVisibleSpaces 158
#define ED_cmToggleLineNumbers 159
#define ED_cmSetInsert 160
#define ED_cmSetAutoIndent 161
#define ED_cmSetAutoUnindent 162
#define ED_cmSetWordWrap 165
#define ED_cmShowRuler 167
#define ED_cmShowVisibleSpaces 168
#define ED_cmShowLineNumbers 169

#define ED_cmStartLineDraw 180
#define ED_cmEndLineDraw 181
#define ED_cmToggleLineDraw 182
#define ED_cmLineDrawStyle 183

#define ED_cmExpandTabsToSpaces 200
#define ED_cmCompressSpacesToTabs 201
#define ED_cmTab8TextToTab3Text 202
#define ED_cmTab3TextToTab8Text 203
#define ED_cmTab8TextToCurTabText 204
#define ED_cmCurTabTextToTab8Text 205
#define ED_cmConvertText 207
#define ED_cmSort 208
#define ED_cmWordCount 209
#define ED_cmSpelling 212

#define ED_cmCommentBlock 220
#define ED_cmUncommentBlock 221
#define ED_cmCommentBlockCpp 222
#define ED_cmUncommentBlockCpp 223
#define ED_cmCommentBlockAsm 224
#define ED_cmUncommentBlockAsm 225
#define ED_cmCommentBlockRem 226
#define ED_cmUncommentBlockRem 227
#define ED_cmCommentBlockTeX 228
#define ED_cmUncommentBlockTeX 229

#define ED_cmRecordMacro 230
#define ED_cmMacroStopRecorder 231
#define ED_cmMacro 232

#define ED_cmSaveFile 250
#define ED_cmSaveFileAs 251
#define ED_cmWriteBlock 252
#define ED_cmReadBlock 253
#define ED_cmOpenFile 254
#define ED_cmNewFile 255
#define ED_cmPrint 256
#define ED_cmOpenFileAtCursor 257
#define ED_cmOpenHeaderFile 258
#define ED_cmIncludeFiles 259

#define ED_cmUserTool1 280
#define ED_cmUserTool2 281
#define ED_cmUserTool3 282
#define ED_cmUserTool4 283
#define ED_cmUserTool5 284
#define ED_cmUserTool6 285
#define ED_cmUserTool7 286
#define ED_cmUserTool8 287
#define ED_cmUserTool9 288

#define ED_cmWindowMaximize 290
#define ED_cmWindowMinimize 291
#define ED_cmWindowRestore 292
#define ED_cmWindowCascade 293
#define ED_cmWindowTileHorz 294
#define ED_cmWindowTileVert 295
#define ED_cmPrevWindow 296
#define ED_cmNextWindow 297

#define ED_cmHelpKeywordSearch 300
#define ED_cmHelpContents 301
#define ED_cmApiAssistanceOn 305

#define ED_cmPlugInCommand 310
#define ED_cmPlugInCommandID 311


#define ED_FROM_SHORTCUT 0x0001
#define ED_FROM_MENU 0x0002
#define ED_FROM_DIALOG 0x0004
#define ED_FROM_MACRO 0x0100
#define ED_FROM_SCRIPT 0x0200
#define ED_FROM_API ED_FROM_SCRIPT
#define ED_MASK_FROM_USER 0x00FF
#define ED_MASK_FROM_AUTOMATION 0x1F00
#define ED_FROM_DONTSEND 0x8000

/* GM commands */
// Gte_EdCmd is short name for Gte_EditorCommand
// do not use it directly, because it can be removed in the next version
#define GM_NullCmd(h) Gte_EdCmd(h,1,0)
#define GM_InsertChar(h,c) Gte_EdCmd(h,2,c)
#define GM_BackTab(h) Gte_EdCmd(h,3,0)
#define GM_PrevTabPos(h) Gte_EdCmd(h,3,0)
#define GM_InsertSymbol(h) Gte_EdCmd(h,4,0)
#define GM_Tab(h) Gte_EdCmd(h,5,0)
#define GM_Backspace(h) Gte_EdCmd(h,6,0)
#define GM_Delete(h) Gte_EdCmd(h,7,0)
#define GM_DeleteChar(h) Gte_EdCmd(h,8,0)
#define GM_DeleteBlock(h) Gte_EdCmd(h,9,0)
#define GM_DeleteWord(h) Gte_EdCmd(h,10,0)
#define GM_DeleteToEOL(h) Gte_EdCmd(h,11,0)
#define GM_DeleteToBOL(h) Gte_EdCmd(h,12,0)
#define GM_DeleteLine(h) Gte_EdCmd(h,13,0)
#define GM_DeleteWordBack(h) Gte_EdCmd(h,14,0)
#define GM_NewLine(h) Gte_EdCmd(h,15,0)
#define GM_InsertLine(h) Gte_EdCmd(h,16,0)
#define GM_DupLine(h) Gte_EdCmd(h,17,0)
#define GM_JoinLine(h) Gte_EdCmd(h,18,0)
#define GM_CenterLine(h) Gte_EdCmd(h,19,0)
#define GM_InsertComment(h) Gte_EdCmd(h,20,0)
#define GM_InsertTimeDate(h) Gte_EdCmd(h,21,0)
#define GM_InsertTime(h) Gte_EdCmd(h,22,0)
#define GM_InsertDate(h) Gte_EdCmd(h,23,0)
#define GM_InsertCommentLight(h) Gte_EdCmd(h,24,0)
#define GM_DeleteBookmarkedLines(h) Gte_EdCmd(h,25,0)

#define GM_CursorLeft(h) Gte_EdCmd(h,30,0)
#define GM_CursorRight(h) Gte_EdCmd(h,31,0)
#define GM_CursorUp(h) Gte_EdCmd(h,32,0)
#define GM_CursorDown(h) Gte_EdCmd(h,33,0)
#define GM_PageUp(h) Gte_EdCmd(h,34,0)
#define GM_PageDown(h) Gte_EdCmd(h,35,0)
#define GM_LineStart(h) Gte_EdCmd(h,36,0)
#define GM_LineEnd(h) Gte_EdCmd(h,37,0)
#define GM_WordLeft(h) Gte_EdCmd(h,38,0)
#define GM_WordRight(h) Gte_EdCmd(h,39,0)
#define GM_TextStart(h) Gte_EdCmd(h,40,0)
#define GM_TextEnd(h) Gte_EdCmd(h,41,0)
#define GM_TopOfWindow(h) Gte_EdCmd(h,42,0)
#define GM_BottomOfWindow(h) Gte_EdCmd(h,43,0)
#define GM_ScrollUp(h) Gte_EdCmd(h,44,0)
#define GM_ScrollDown(h) Gte_EdCmd(h,45,0)
#define GM_FirstNonBlank(h) Gte_EdCmd(h,46,0)
#define GM_ParaUp(h) Gte_EdCmd(h,47,0)
#define GM_ParaDown(h) Gte_EdCmd(h,48,0)
#define GM_NextTabPos(h) Gte_EdCmd(h,49,0)
#define GM_WordLeftMS(h) Gte_EdCmd(h,370,0)
#define GM_WordRightMS(h) Gte_EdCmd(h,371,0)
#define GM_WordLeftSmart(h) Gte_EdCmd(h,372,0)
#define GM_WordRightSmart(h) Gte_EdCmd(h,373,0)

#define GM_LeftSelect(h) Gte_EdCmd(h,50,0)
#define GM_RightSelect(h) Gte_EdCmd(h,51,0)
#define GM_UpSelect(h) Gte_EdCmd(h,52,0)
#define GM_DownSelect(h) Gte_EdCmd(h,53,0)
#define GM_PageUpSelect(h) Gte_EdCmd(h,54,0)
#define GM_PageDownSelect(h) Gte_EdCmd(h,55,0)
#define GM_LineStartSelect(h) Gte_EdCmd(h,56,0)
#define GM_LineEndSelect(h) Gte_EdCmd(h,57,0)
#define GM_WordLeftSelect(h) Gte_EdCmd(h,58,0)
#define GM_WordRightSelect(h) Gte_EdCmd(h,59,0)
#define GM_TextStartSelect(h) Gte_EdCmd(h,60,0)
#define GM_TextEndSelect(h) Gte_EdCmd(h,61,0)
#define GM_TopOfWindowSelect(h) Gte_EdCmd(h,62,0)
#define GM_BottomOfWindowSelect(h) Gte_EdCmd(h,63,0)
#define GM_ParaUpSelect(h) Gte_EdCmd(h,64,0)
#define GM_ParaDownSelect(h) Gte_EdCmd(h,65,0)
#define GM_PrevTabPosSelect(h) Gte_EdCmd(h,68,0)
#define GM_NextTabPosSelect(h) Gte_EdCmd(h,69,0)
#define GM_WordLeftMSSelect(h) Gte_EdCmd(h,380,0)
#define GM_WordRightMSSelect(h) Gte_EdCmd(h,381,0)
#define GM_WordLeftSmartSelect(h) Gte_EdCmd(h,382,0)
#define GM_WordRightSmartSelect(h) Gte_EdCmd(h,383,0)

#define GM_StartSelect(h) Gte_EdCmd(h,70,0)
#define GM_EndSelect(h) Gte_EdCmd(h,71,0)
#define GM_HideSelect(h) Gte_EdCmd(h,72,0)
#define GM_SelectWord(h) Gte_EdCmd(h,73,0)
#define GM_SelectLine(h) Gte_EdCmd(h,74,0)
#define GM_SelectAll(h) Gte_EdCmd(h,75,0)
#define GM_SelectPara(h) Gte_EdCmd(h,76,0)
#define GM_ToggleSelMode(h) Gte_EdCmd(h,77,0)
#define GM_SetCharSelMode(h) Gte_EdCmd(h,78,0)
#define GM_SetColumnSelMode(h) Gte_EdCmd(h,79,0)

#define GM_IndentBlock(h) Gte_EdCmd(h,80,0)
#define GM_UnindentBlock(h) Gte_EdCmd(h,81,0)
#define GM_FillBlock(h) Gte_EdCmd(h,82,0)
#define GM_LeftBlockPara(h) Gte_EdCmd(h,86,0)
#define GM_CenterBlockPara(h) Gte_EdCmd(h,87,0)
#define GM_RightBlockPara(h) Gte_EdCmd(h,88,0)
#define GM_JustifyBlockPara(h) Gte_EdCmd(h,89,0)

#define GM_Find(h) Gte_EdCmd(h,90,0)
#define GM_Replace(h) Gte_EdCmd(h,91,0)
#define GM_FindNext(h) Gte_EdCmd(h,92,0)
#define GM_GoToLine(h) Gte_EdCmd(h,93,0)
#define GM_GoToColumn(h) Gte_EdCmd(h,94,0)
#define GM_MatchPair(h) Gte_EdCmd(h,95,0)
#define GM_FindNextWord(h) Gte_EdCmd(h,96,0)
#define GM_FindPrevWord(h) Gte_EdCmd(h,97,0)
#define GM_MatchPreprocNext(h) Gte_EdCmd(h,98,0)
#define GM_MatchPreprocPrev(h) Gte_EdCmd(h,99,0)
#define GM_MatchHtmlTag(h) Gte_EdCmd(h,431,0)
#define GM_NextCompilerError(h) Gte_EdCmd(h,424,0)
#define GM_PrevCompilerError(h) Gte_EdCmd(h,435,0)
#define GM_GoToLineNum(h, n) Gte_EdCmd(h,436,n)
#define GM_GoToColumnNum(h, n) Gte_EdCmd(h,437,n)
#define GM_FindPrev(h, n) Gte_EdCmd(h,439,0)

#define GM_SetMark0(h) Gte_EdCmd(h,100,0)
#define GM_SetMark1(h) Gte_EdCmd(h,101,0)
#define GM_SetMark2(h) Gte_EdCmd(h,102,0)
#define GM_SetMark3(h) Gte_EdCmd(h,103,0)
#define GM_SetMark4(h) Gte_EdCmd(h,104,0)
#define GM_SetMark5(h) Gte_EdCmd(h,105,0)
#define GM_SetMark6(h) Gte_EdCmd(h,106,0)
#define GM_SetMark7(h) Gte_EdCmd(h,107,0)
#define GM_SetMark8(h) Gte_EdCmd(h,108,0)
#define GM_SetMark9(h) Gte_EdCmd(h,109,0)
#define GM_GotoMark0(h) Gte_EdCmd(h,110,0)
#define GM_GotoMark1(h) Gte_EdCmd(h,111,0)
#define GM_GotoMark2(h) Gte_EdCmd(h,112,0)
#define GM_GotoMark3(h) Gte_EdCmd(h,113,0)
#define GM_GotoMark4(h) Gte_EdCmd(h,114,0)
#define GM_GotoMark5(h) Gte_EdCmd(h,115,0)
#define GM_GotoMark6(h) Gte_EdCmd(h,116,0)
#define GM_GotoMark7(h) Gte_EdCmd(h,117,0)
#define GM_GotoMark8(h) Gte_EdCmd(h,118,0)
#define GM_GotoMark9(h) Gte_EdCmd(h,119,0)
#define GM_BookmarkToggle(h) Gte_EdCmd(h,390,0)
#define GM_BookmarkSet(h) Gte_EdCmd(h,391,0)
#define GM_BookmarkClearAll(h) Gte_EdCmd(h,392,0)
#define GM_BookmarkPrev(h) Gte_EdCmd(h,393,0)
#define GM_BookmarkNext(h) Gte_EdCmd(h,394,0)
#define GM_SaveCursorPos(h) Gte_EdCmd(h,398,0)
#define GM_RestoreCursorPos(h) Gte_EdCmd(h,399,0)

#define GM_Undo(h) Gte_EdCmd(h,120,0)
#define GM_Redo(h) Gte_EdCmd(h,121,0)
#define GM_Cut(h) Gte_EdCmd(h,123,0)
#define GM_Copy(h) Gte_EdCmd(h,124,0)
#define GM_Paste(h) Gte_EdCmd(h,125,0)
#define GM_CutAndAppend(h) Gte_EdCmd(h,126,0)
#define GM_CopyAndAppend(h) Gte_EdCmd(h,127,0)
#define GM_CutLine(h) Gte_EdCmd(h,128,0)
#define GM_CopyLine(h) Gte_EdCmd(h,129,0)
#define GM_CutBookmarkedLines(h) Gte_EdCmd(h,400,0)
#define GM_CopyBookmarkedLines(h) Gte_EdCmd(h,401,0)


#define GM_UpperCase(h) Gte_EdCmd(h,130,0)
#define GM_LowerCase(h) Gte_EdCmd(h,131,0)
#define GM_FlipCase(h) Gte_EdCmd(h,132,0)
#define GM_UpperCaseWord(h) Gte_EdCmd(h,133,0)
#define GM_LowerCaseWord(h) Gte_EdCmd(h,134,0)
#define GM_FlipCaseWord(h) Gte_EdCmd(h,135,0)
#define GM_CapitalizeWord(h) Gte_EdCmd(h,136,0)
#define GM_TitleCase(h) Gte_EdCmd(h,137,0)
#define GM_SentenceCase(h) Gte_EdCmd(h,138,0)

#define GM_TransposeChar(h) Gte_EdCmd(h,140,0)
#define GM_TransposeWord(h) Gte_EdCmd(h,141,0)
#define GM_TransposeLine(h) Gte_EdCmd(h,142,0)

#define GM_ToggleInsert(h) Gte_EdCmd(h,150,0)
#define GM_ToggleAutoIndent(h) Gte_EdCmd(h,151,0)
#define GM_ToggleAutoUnindent(h) Gte_EdCmd(h,152,0)
#define GM_ToggleWordWrap(h) Gte_EdCmd(h,155,0)
#define GM_ToggleRuler(h) Gte_EdCmd(h,157,0)
#define GM_ToggleVisibleSpaces(h) Gte_EdCmd(h,158,0)
#define GM_ToggleLineNumbers(h) Gte_EdCmd(h,159,0)
#define GM_SetInsert(h) Gte_EdCmd(h,160,0)
#define GM_SetAutoIndent(h) Gte_EdCmd(h,161,0)
#define GM_SetAutoUnindent(h) Gte_EdCmd(h,162,0)
#define GM_SetWordWrap(h) Gte_EdCmd(h,165,0)
#define GM_ShowRuler(h) Gte_EdCmd(h,167,0)
#define GM_ShowVisibleSpaces(h) Gte_EdCmd(h,168,0)
#define GM_ShowLineNumbers(h) Gte_EdCmd(h,169,0)

#define GM_StartLineDraw(h) Gte_EdCmd(h,180,0)
#define GM_EndLineDraw(h) Gte_EdCmd(h,181,0)
#define GM_ToggleLineDraw(h) Gte_EdCmd(h,182,0)
#define GM_LineDrawStyle(h) Gte_EdCmd(h,183,0)

#define GM_ExpandTabsToSpaces(h) Gte_EdCmd(h,200,0)
#define GM_CompressSpacesToTabs(h) Gte_EdCmd(h,201,0)
#define GM_Tab8TextToTab3Text(h) Gte_EdCmd(h,202,0)
#define GM_Tab3TextToTab8Text(h) Gte_EdCmd(h,203,0)
#define GM_Tab8TextToCurTabText(h) Gte_EdCmd(h,204,0)
#define GM_CurTabTextToTab8Text(h) Gte_EdCmd(h,205,0)
#define GM_ConvertText(h) Gte_EdCmd(h,207,0)
#define GM_Sort(h) Gte_EdCmd(h,208,0)
#define GM_WordCount(h) Gte_EdCmd(h,209,0)
#define GM_Spelling(h) Gte_EdCmd(h,212,0)

#define GM_CommentBlock(h,c) Gte_EdCmd(h,220,c)
#define GM_UncommentBlock(h,c) Gte_EdCmd(h,221,c)
#define GM_CommentBlockCpp(h) Gte_EdCmd(h,222,0)
#define GM_UncommentBlockCpp(h) Gte_EdCmd(h,223,0)
#define GM_CommentBlockAsm(h) Gte_EdCmd(h,224,0)
#define GM_UncommentBlockAsm(h) Gte_EdCmd(h,225,0)
#define GM_CommentBlockRem(h) Gte_EdCmd(h,226,0)
#define GM_UncommentBlockRem(h) Gte_EdCmd(h,227,0)
#define GM_CommentBlockTeX(h) Gte_EdCmd(h,228,0)
#define GM_UncommentBlockTeX(h) Gte_EdCmd(h,229,0)

#define GM_RecordMacro(h) Gte_EdCmd(h,230,0)
#define GM_MacroStopRecorder(h) Gte_EdCmd(h,231,0)
#define GM_Macro(h) Gte_EdCmd(h,232,0)

#define GM_SaveFile(h) Gte_EdCmd(h,250,0)
#define GM_SaveFileAs(h) Gte_EdCmd(h,251,0)
#define GM_WriteBlock(h) Gte_EdCmd(h,252,0)
#define GM_ReadBlock(h) Gte_EdCmd(h,253,0)
#define GM_OpenFile(h) Gte_EdCmd(h,254,0)
#define GM_NewFile(h) Gte_EdCmd(h,255,0)
#define GM_Print(h) Gte_EdCmd(h,256,0)
#define GM_OpenFileAtCursor(h) Gte_EdCmd(h,257,0)
#define GM_OpenHeaderFile(h) Gte_EdCmd(h,258,0)
#define GM_IncludeFiles(h) Gte_EdCmd(h,259,0)

#define GM_UserTool1(h) Gte_EdCmd(h,280,0)
#define GM_UserTool2(h) Gte_EdCmd(h,281,0)
#define GM_UserTool3(h) Gte_EdCmd(h,282,0)
#define GM_UserTool4(h) Gte_EdCmd(h,283,0)
#define GM_UserTool5(h) Gte_EdCmd(h,284,0)
#define GM_UserTool6(h) Gte_EdCmd(h,285,0)
#define GM_UserTool7(h) Gte_EdCmd(h,286,0)
#define GM_UserTool8(h) Gte_EdCmd(h,287,0)
#define GM_UserTool9(h) Gte_EdCmd(h,288,0)

#define GM_WindowMaximize(h) Gte_EdCmd(h,290,0)
#define GM_WindowMinimize(h) Gte_EdCmd(h,291,0)
#define GM_WindowRestore(h) Gte_EdCmd(h,292,0)
#define GM_WindowCascade(h) Gte_EdCmd(h,293,0)
#define GM_WindowTileHorz(h) Gte_EdCmd(h,294,0)
#define GM_WindowTileVert(h) Gte_EdCmd(h,295,0)
#define GM_PrevWindow(h) Gte_EdCmd(h,296,0)
#define GM_NextWindow(h) Gte_EdCmd(h,297,0)

#define GM_HelpKeywordSearch(h) Gte_EdCmd(h,300,0)
#define GM_HelpContents(h) Gte_EdCmd(h,301,0)
#define GM_ApiAssistanceOn(h) Gte_EdCmd(h,305,0)

#define GM_PlugInCommand(h) Gte_EdCmd(h,310,0)
#define GM_PlugInCommandID(h,n) Gte_EdCmd(h,311,n)
06/05/2013 14:26 ernilos#5
Quote:
Originally Posted by oiakrap View Post
yes xD

this commands are good?

look...
What ** shit is it?
---
Respect theme u are sure to add well mysql and start server with myswl dlls?
06/05/2013 21:40 oiakrap#6
ernilos I use libmysql.lib, need more? and I use this mysql -->>

Quote:
int _tmain(int argc, _TCHAR* argv[])
{
MYSQL *nosdb;
if ((nosdb = mysql_init (NULL)) == NULL) {
cout << " CRITICAL ERROR: Can't start mysql" << endl;
getchar();
exit(1);
}else{
if(!mysql_real_connect(nosdb, "127.0.0.1" ,"root", "1009" ,"nostalexD", 3306, 0,0))
{cout << " CRITICAL ERROR: Can't connect to DB" << endl;
getchar();
exit(1);}
else
{cout << "Service MySQL Started" << endl;}
}
MYSQL_ROW mrow;
MYSQL_RES *mres;
}
its wrong? I made what Elektro learned. and the error is...

don't connect server

but I don't know if login error or game error. ernilos can u help me plz?

=/
06/05/2013 23:22 ernilos#7
Try with: MYSQL nosdb; and mysql_real_connect(&nosdb...); use normal object, not a pointer><
06/06/2013 01:05 oiakrap#8
I started my server and not enter =/, show me a screen without my channel name T.T. I think gave to be how I made dump on my MYSQL WorkBench. what I'm doing wrong? I see here videos about how to dump the databses and Xampp. but give me these errors ^^.but ty ernilos xD
06/06/2013 01:47 Elektrochemie#9
If you have no clue how to code in c++... learn it first..
Looks like you just copy & pasted some codesnippets :D
06/06/2013 02:06 oiakrap#10
hmm xD
06/06/2013 02:28 Elektrochemie#11
are you sure that this

,"root", "1009" ,"nostalexD"

is correct?
06/06/2013 14:58 oiakrap#12
but I don't know if "nostalexD" is name server or database xD, but my gameserver it's function. but I think problem is my loginserver =/. exemple my login and game is how user "root", "mypassdb" and "nosdb" database in mysql or xampp mysql. xD

elektro I think u use this commands for read and write archives?

Quote:
#include <windows.h>
#include <tchar.h>
#include <stdio.h>

int main()
{
TCHAR inBuf[80];
HKEY hKey1, hKey2;
DWORD dwDisposition;
LONG lRetCode;
TCHAR szData[] = TEXT("USR:App Name\\Section1");

// Create the .ini file key.
lRetCode = RegCreateKeyEx ( HKEY_LOCAL_MACHINE,
TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\IniFileMapping\\appname.ini"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
&hKey1,
&dwDisposition);

if (lRetCode != ERROR_SUCCESS)
{
printf ("Error in creating appname.ini key (%d).\n", lRetCode);
return (0) ;
}

// Set a section value
lRetCode = RegSetValueEx ( hKey1,
TEXT("Section1"),
0,
REG_SZ,
(BYTE *)szData,
sizeof(szData));

if (lRetCode != ERROR_SUCCESS)
{
printf ("Error in setting Section1 value\n");
// Close the key
lRetCode = RegCloseKey( hKey1 );
if( lRetCode != ERROR_SUCCESS )
{
printf("Error in RegCloseKey (%d).\n", lRetCode);
return (0) ;
}
}

// Create an App Name key
lRetCode = RegCreateKeyEx ( HKEY_CURRENT_USER,
TEXT("App Name"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
&hKey2,
&dwDisposition);

if (lRetCode != ERROR_SUCCESS)
{
printf ("Error in creating App Name key (%d).\n", lRetCode);

// Close the key
lRetCode = RegCloseKey( hKey2 );
if( lRetCode != ERROR_SUCCESS )
{
printf("Error in RegCloseKey (%d).\n", lRetCode);
return (0) ;
}
}

// Force the system to read the mapping into shared memory
// so that future invocations of the application will see it
// without the user having to reboot the system
WritePrivateProfileStringW( NULL, NULL, NULL, L"appname.ini" );

// Write some added values
WritePrivateProfileString (TEXT("Section1"),
TEXT("FirstKey"),
TEXT("It all worked out OK."),
TEXT("appname.ini"));
WritePrivateProfileString (TEXT("Section1"),
TEXT("SecondKey"),
TEXT("By golly, it works!"),
TEXT("appname.ini"));
WritePrivateProfileString (TEXT("Section1"),
TEXT("ThirdKey"),
TEXT("Another test..."),
TEXT("appname.ini"));

// Test
GetPrivateProfileString (TEXT("Section1"),
TEXT("FirstKey"),
TEXT("Error: GPPS failed"),
inBuf,
80,
TEXT("appname.ini"));
_tprintf (TEXT("Key: %s\n"), inBuf);

// Close the keys
lRetCode = RegCloseKey( hKey1 );
if( lRetCode != ERROR_SUCCESS )
{
printf("Error in RegCloseKey (%d).\n", lRetCode);
return(0);
}

lRetCode = RegCloseKey( hKey2 );
if( lRetCode != ERROR_SUCCESS )
{
printf("Error in RegCloseKey (%d).\n", lRetCode);
return(0);
}

return(1);
}

how to use?

srry guys double post =/