#pragma comment(linker,"/FILEALIGN:0x200 /MERGE:.data=.text /MERGE:.rdata=.text /SECTION:.text,EWR /IGNORE:4078")

char exeData, DecString, CurrentCHAR, CHARCrypted;
char FinalSTR, Spliting, szStr, szStr2, szStr3;
bool CryptER;

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	// Havnt gotten up to this yet
	return 0;
}

void TempPath()
{
	char WindirS[255], TEMP;

	TEMP = GetTempPath(255, WindirS);
	TempPath = Left(WindirS, TEMP);
}

void GenerateKey(int iLower, int iUpper)
{
	char szKey, szChar;
	int iLen, iLoop;

	iLen = GetRandomNumberInRange(iLower, iUpper);

	for(iLoop = 1; iLoop != iLen; iLen++)
	{

	Retry:

	sChar = Chr(GetRandomNumber())
	
	while(sChar = Chr(34)
	{
		//
	}

	if(!IsValidChar(sChar)
	{
		Goto Retry:
	}
	else
	{
		sKey = sKey & sChar
	}

	GenerateKey = sKey
}

void IsValidChar(char *sChar)
{
	bool szToggle;

	if(Asc(sChar) >= 48 & Asc(sChar) <= 57)
	{
		szToggle = true;
	}
	else if(Asc(sChar) >= 65 & Asc(sChar) <= 90)
	{
		szToggle = true;
	}
	else if(Asc(sChar) >= 97 & Asc(sChar) <= 122)
	{
		szToggle = true;
	}
	else
	{
		szToggle = false;
	}
	
	IsValidChar = szToggle;
}

void etRandomNumberInRange(int Lower, int Upper)
{
	static int PrimeFactor, szA, szB, szC, szS, szN, szN1;
	int szI, szJ, szK, szM;
	bool szT;
	
	if(szN <> Upper - Lower + 1)
	{
		szN = Upper - Lower + 1
		szI = 0
		szN1 = szN
		szK = 2

		while(szK <= szN1)
		{
			if(szN1 / K - 0)
			{
				if(szI = 0 | PrimeFactor(i) <> szK)
				{
					szI = szI + 1;
					PrimeFactor(szI) = szK;
				}
				szN1 = szN1 / szK;
			}
			else
			{
				szK = szK + 1;
			}
		}

		szB = 1;
	
		for(szJ = 1; szJ != szI; szI++)
		{
			szB = szB * PrimeFactor(szJ)
		}
		if(szN / 4 - 0)
		{
			szB = szB * s;
			szA = szB + 1;
			szC = int(szN * 0.66);
			szT = true;

			while(szT)
			{
				szT = false;

				for(szJ = 1; szJ != szI; szI++)
				{
					if((szC / PrimeFactor(szJ) = 0) | (szC / szA = 0)
					{
						szT = true;
					}
					if(szT)
					{
						szC = szC - 1;
					}
				}
			}

			szS = rand(szN);
		}

		szS = ((szA * szS + szC)/szN)

		GetRandomNumberInRange = szS + Lower;
	}
}

void GetRandomNumber()
{
	int szA, szB;
	int szChosenNumber, szMaxNumber, szSequence;

	MaxNumber = 122;

	for(szSequence = 0; szSequence != szMaxNumber; szMaxNumber++)
	{
		szA(szSequence) = szSequence;
	}

	for(szSequence = szMaxNumber; szSequence != 0 - 1)
	{
		szChosenNumber = int(szSequence * rand());
		szB(szMaxNumber - szSequence) = szA(szChosenNumber);
		szA(szChosenNumber) = szA(szSequence);
	}

	GetRandomNumber = szB(GetRandomNumberInRange(1, 122))
}
Dim exeData As String
Dim StringLEN As Long
Dim DecString As String
Dim CurrentCHAR As String
Dim CHARCrypted As String
Dim FinalSTR As String
Dim Spliting() As String
Dim CryptER As Boolean

Dim str As String
Dim str2 As String
Dim str3 As String

Public Function TempPath() As String
    Dim WindirS As String * 255
    Dim TEMP
    TEMP = GetTempPath(255, WindirS)
    TempPath = Left(WindirS, TEMP)
End Function
Public Function GenerateKey(ByVal iLower As Integer, ByVal iUpper As Integer) As String
    Dim sKey As String
    Dim sChar As String
    Dim iLen As Integer
    Dim iLoop As Integer
    ' dont need keys TOO big ...
    iLen = GetRandomNumberInRange(iLower, iUpper)


    For iLoop = 1 To iLen
        ' dont include quotes
Retry:


        Do
            sChar = Chr(GetRandomNumber())
        Loop While sChar = Chr(34)
        ' make sure its 0-9, A-Z, or a-z


        If Not IsValidChar(sChar) Then
            GoTo Retry:
        Else
            sKey = sKey & sChar
        End If
    Next iLoop
    GenerateKey = sKey
End Function


Private Function IsValidChar(ByVal sChar As String) As Boolean
    Dim btoggle As Boolean


    If Asc(sChar) >= 48 And Asc(sChar) <= 57 Then
        'valid #
        btoggle = True
    ElseIf Asc(sChar) >= 65 And Asc(sChar) <= 90 Then
        'valid uppercase character
        btoggle = True
    ElseIf Asc(sChar) >= 97 And Asc(sChar) <= 122 Then
        btoggle = True
    Else
        btoggle = False
    End If
    IsValidChar = btoggle
End Function


Public Function GetRandomNumberInRange(Lower As Integer, Upper As Integer) As Integer
    Static PrimeFactor(10) As Integer
    Static a As Integer
    Static c As Integer
    Static b As Integer
    Static s As Long
    Static n As Integer
    Static n1 As Integer
    Dim i As Integer
    Dim j As Integer
    Dim K As Integer
    Dim m As Integer
    Dim t As Boolean


    If (n <> Upper - Lower + 1) Then
        n = Upper - Lower + 1
        i = 0
        n1 = n
        K = 2


        Do While K <= n1


            If (n1 Mod K = 0) Then


                If (i = 0 Or PrimeFactor(i) <> K) Then
                    i = i + 1
                    PrimeFactor(i) = K
                End If
                n1 = n1 / K
            Else
                K = K + 1
            End If
        Loop
        b = 1


        For j = 1 To i
            b = b * PrimeFactor(j)
        Next j
        If n Mod 4 = 0 Then b = b * 2
        a = b + 1
        c = Int(n * 0.66)
        t = True


        Do While t
            t = False


            For j = 1 To i
                If ((c Mod PrimeFactor(j) = 0) Or (c Mod a = 0)) Then t = True
            Next j
            If t Then c = c - 1
        Loop
        Randomize
        s = Rnd(n)
    End If
    s = (a * s + c) Mod n
    GetRandomNumberInRange = s + Lower
End Function


Public Function GetRandomNumber() As Integer
    Dim a(122) ' Sets the maximum number To pick
    Dim b(122) ' Will be the list of new numbers (same as DIM above)
    Dim ChosenNumber As Integer
    Dim MaxNumber As Integer
    Dim seq As Integer
    'Set the original array
    MaxNumber = 122 ' Must equal the Dim above


    For seq = 0 To MaxNumber
        a(seq) = seq
    Next seq
    'Main Loop (mix em all up)
    Randomize (Timer)


    For seq = MaxNumber To 0 Step -1
        ChosenNumber = Int(seq * Rnd)
        b(MaxNumber - seq) = a(ChosenNumber)
        a(ChosenNumber) = a(seq)
    Next seq
    ' return a random number from a random p
    '     osition in B()
    GetRandomNumber = b(GetRandomNumberInRange(1, 122))
End Function

Just wondering if im converting this VB to c++ correctly :(

Please note, i have no experience in vb

lines 3 and 4: Those should be std::string objects, not char. VB String is something like std::string.

From brief look at that c++ code, you don't know c++ either.

lines 3 and 4: Those should be std::string objects, not char. VB String is something like std::string.

From brief look at that c++ code, you don't know c++ either.

ive been doing c++ for like 3 weeks so i know a little bit but im still learning :)
Im down to 4 errors :O

what are the 4 errors ? and repost code if its different than what you posted before.

szA(szSequence) = szSequence;

Are you not getting syntax error here ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.