Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-02-2004, 04:46 PM
ymhy_80's Avatar
New kid on the block
 
Join Date: Feb 2004
Location: cyberjaya
Posts: 7
Rep Power: 0
ymhy_80 is on a distinguished road
Send a message via Yahoo to ymhy_80
#define class error dlm java prog

ni ada contoh prog yang saya ambik kat internet untuk panggil cert store dan listkan dlm web page ,and saya cuba compilekan,and ada error muncul kat bhg ini:

#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <jni.h>
#include <wincrypt.h>
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)

#include "Testapp.h"

saya cuba surf byk tempat tapi agak blur so mintak tolong sgt nie
tlg jelas kan yer.



yang kat bwh ni permulaan prog code dia

import java.awt.*;
import java.io.*;
import java.lang.*;
import java.applet.*;

public class Testapp extends Applet {



String ret=null;


public void init(){




System.out.println("in init");

loaddll();

}

public void loaddll(){


System.out.println("before loading DLL");
System.loadLibrary("Msgimpl");
System.out.println("After loading DLL");

}

private native String crypto(String store);


public void paint(Graphics g) {
g.setColor(Color.blue);
g.setColor(Color.magenta);



g.drawString("call before native function", 25, 25);


ret=crypto("My");


g.drawString(ret, 25, 50);

g.drawString("Finally", 25, 75);

}

#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <jni.h>
#include <wincrypt.h>
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)

#include "Testapp.h"

}



BOOL APIENTRY DllMain(HANDLE hModule,
DWORD dwReason, void** lpReserved) {
return TRUE;
}

JNIEXPORT jstring JNICALL
Java_Testapp_crypto(JNIEnv * jEnv,jobject obj,jstring jstore) {
HCRYPTPROV hProv;
BOOL bResult;
HCERTSTORE hStoreHandle = NULL;
PCCERT_CONTEXT pCertContext = NULL;
char pszNameString[256];
CRYPT_KEY_PROV_INFO *pCryptKeyProvInfo;
DWORD dwPropId=0;
DWORD cbData;
const char *msg;

jstring jstr;
msg = (*jEnv)->GetStringUTFChars(jEnv, jstore,0);

//printf("Before context\n");

if (hStoreHandle = CertOpenSystemStore(NULL,msg))
{
printf("The %s store has been opened. \n", msg);
}
else
{
printf("The store was not opened.\n");
exit(1);
}

while(pCertContext= CertEnumCertificatesInStore(hStoreHandle,pCertCont ext))
// on the first call to the function,
// this parameter is NULL
// on all subsequent calls,
// this parameter is the last pointer
// returned by the function
{


if(CertGetNameString(pCertContext,CERT_NAME_FRIEND LY_DISPLAY_TYPE,0,NULL,pszNameString,1000))
{
printf("\nCertificate for %s \n",pszNameString);
}
else
{
printf("\nGetNameFailed\n");
}




}//main while
return (*jEnv)->NewStringUTF(jEnv, pszNameString);
//(*jEnv)->ReleaseStringUTFChars(jEnv, jstore,msg);




if (!CertCloseStore(hStoreHandle,0))
{
//printf("Failed CertCloseStore\n");
exit(1);
}


//printf("After context\n");




}




thank u in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-02-2004, 08:39 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 118
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
well... depend on my knowledge of C and JAVA ( :P ), starting from line #define _WIN32_WINNT 0x0400 until the end, are C source code, not Java.

Since you did not provide the URL of where you the these codes, we have difficulty to trace the errors.

Try...

From the codes, it seems like divide into two parts. The Java applet and C. Try to save all codes infront line #define _WIN32_WINNT 0x0400 to filename Testapp.h

Then, create a C source code file and paste all codes begin from #define _WIN32_WINNT 0x0400 until then end into it, compile and run.

I am sure there is/are still error(s)... } after #include "Testapp.h" seems like reduntant...

Just my little ideas. Good luck!
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-02-2004, 04:49 PM
masterix's Avatar
Novice Webmaster
 
Join Date: Feb 2003
Location: Pangsapuri Kelana Impian, Petaling Jaya
Posts: 9
Rep Power: 0
masterix is on a distinguished road
Send a message via Yahoo to masterix
fuuu, complicatednye source code yang ko kasik nih. aku suggest better carik lain la, aku pon pening tengok. ape yang ko nak buat actually, nak buat authentication certificate untuk secure transaction ke?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-02-2004, 05:29 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 97
sufyan is on a distinguished road
Your trying to develop some hybrid application with source code that is way to complex for a beginner. I suggest that you start simple and stick to a single language.

I think you need to learn the fundamentals of the language before you can even think of tackling projects like this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-02-2004, 11:37 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 118
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
I guess he/she just simply copy & paste the code that he/she found and think suitable...
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 13-02-2004, 08:52 AM
masterix's Avatar
Novice Webmaster
 
Join Date: Feb 2003
Location: Pangsapuri Kelana Impian, Petaling Jaya
Posts: 9
Rep Power: 0
masterix is on a distinguished road
Send a message via Yahoo to masterix
hmm, ni mesti assignment ni, curik source code kat internet, skali nak run error! hahaha. well, been there, done that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 14-02-2004, 12:01 AM
hymns's Avatar
Senior Webmaster
 
Join Date: Nov 2001
Location: Johor
Posts: 769
Rep Power: 101
hymns is on a distinguished road
Send a message via ICQ to hymns Send a message via Yahoo to hymns
ahaks maybe tepat tekaan kamu masterix
__________________
I hate when:

vBulletin Message:
Sorry! The administrator has specified that users can only post one message every 60 seconds
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
W@P prog. ayeh Website Design 14 09-08-2008 03:39 PM
Define a Web Master dannyfoo Member Introductions 5 15-05-2007 12:42 AM
Internal Server Error - ASP error ladyheart2612 Website Programming 0 21-07-2005 09:22 AM
Hosting: define space limit in subdomain ustazmalaya Paid Hosting Discussion Forum 4 07-11-2004 04:02 PM
Define: nukePHP Acid-kiD Website Programming 0 29-04-2002 01:16 PM


All times are GMT +8. The time now is 03:24 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61