Beispiel #1
0
int validate_version(char* fn) 
{
   int i;
   short u[4];

   // minimum required version
   short r[4] = { 6, 9, 3, 113};

   get_dll_version(fn,u);
   printf("# dbghelp.dll version %d.%d.%d.%d\n", 
          u[0], u[1],u[2],u[3]);

   for(i=0;i<4;i++) {
      if (u[i] > r[i]) 
         break;
      else if (u[i] < r[i]) 
         return 1;
   }
   return 0;
}
Beispiel #2
0
// MW-2005-05-15: Updated for new answer command restructuring
int MCA_folder(MCExecPoint &ep, const char *p_title, const char *p_prompt, const char *p_initial, unsigned int p_options)
{
	if (MCmajorosversion >= 0x0600 && MCModeMakeLocalWindows())
		return MCA_file(ep, p_title, p_prompt, nil, p_initial, p_options | MCA_OPTION_FOLDER_DIALOG);

// MW-2005-05-27: We'll use a static (I know bad me) to store the version
//   of the shell dll.
	static int s_shell_version = -1;
	static char *s_last_folder = NULL;

	char *t_native_filename;
	unsigned int t_native_filename_length;

	if (p_initial != NULL)
	{
		t_native_filename_length = strlen(p_initial);
		t_native_filename = (char *)_alloca(t_native_filename_length + 2);
		strcpy(t_native_filename, p_initial);
		MCU_path2native(t_native_filename);
	}
	else
	{
		t_native_filename = s_last_folder;
		t_native_filename_length = 0;
	}

	if (!MCModeMakeLocalWindows())
	{
		MCRemoteFolderDialog(ep, p_title, p_prompt, t_native_filename);
		if (!ep.isempty())
		{
			if (s_last_folder != NULL)
				delete s_last_folder;
			s_last_folder = ep.getsvalue().clone();
			MCU_path2native(s_last_folder);
		}
		return 0;
	}

	if (s_shell_version == -1)
		s_shell_version = get_dll_version("shell32.dll");

	bool sheet = (p_options & MCA_OPTION_SHEET) != 0;
	char *prompt = (char *)p_prompt;
	
	ep . clear();

	BROWSEINFOA bi;
	memset(&bi, 0, sizeof(BROWSEINFO));

	Window pw;
	pw = MCModeGetParentWindow();

	if (pw != DNULL)
		bi.hwndOwner = (HWND)pw->handle.window;

	bi.pidlRoot = NULL;
	bi.lpszTitle = prompt;
	bi.ulFlags = BIF_RETURNONLYFSDIRS;
	if (s_shell_version >= 500)
		bi.ulFlags |= BIF_NEWDIALOGSTYLE;
	if (t_native_filename != NULL)
	{
		bi . lpfn = BrowseCallbackProc;
		bi . lParam = (LPARAM)t_native_filename;
	}
	else
	{
		bi.lpfn = NULL;
		bi.lParam = NULL;
	}
	LPITEMIDLIST lpiil;
	LPMALLOC lpm;
	char *tdir = NULL;
	SHGetMalloc(&lpm);

	DWORD t_error;
	lpiil = SHBrowseForFolderA(&bi);
	if (lpiil == NULL)
	{
		t_error = GetLastError();
	}
	
	if (lpiil != NULL && SHGetPathFromIDListA(lpiil, ep.getbuffer(PATH_MAX)))
	{
		if (s_last_folder != NULL)
			delete s_last_folder;
		s_last_folder = strclone(ep . getbuffer(0));
		MCU_path2std(ep.getbuffer(0));
		ep.setstrlen();
	}
	else
	{
		ep.clear();
		MCresult->sets(MCcancelstring);
	}
	//  SMR 1880 clear shift and button state
	waitonbutton();

	lpm->Free(lpiil);
	lpm->Release();

	return 0;
}
Beispiel #3
0
BOOL	__stdcall	Rtc4::initialize(FLOAT kfactor, TCHAR* lpszCtbFileName)
{
	INT error = RTC4open();
	if ( 0 != error && -2 != error)
	{
		LOG(_T("fail to initialize the rtc4 library"));
		return FALSE;
	}

	if (kfactor <= 0.0f)
	{
		LOG(_T("invalid bit/mm factor"));
		return FALSE;
	}

	_kfactor = kfactor;

	if (0 == error)	//only once
	{
		// program file load
		error = n_load_program_file(_index+1, "RTC4D2.hex");	//3d -> RTC4D3.hex
		if(0 != error)
		{
			// error io?
			LOG(_T("fail to load the rtc4 program file : %d (%s)"), error, RTC4_ERROR_MSG[error][1] );
			return FALSE;
		}

		INT cardCnt = rtc4_count_cards();
		UINT32 dllVersion = get_dll_version();
		UINT32 hexVersion = get_hex_version();
		UINT32 rtcVersion = get_rtc_version();

		LOG(_T("rtc4 card detected : %d count(s)"), cardCnt);
		LOG(_T("rtc4 dll, hex version : %d, %d"), dllVersion, hexVersion);
		LOG(_T("rtc4 firmware version : %d"), rtcVersion & 0x0F);

		if (rtcVersion & 0x10)
			LOG(_T("processing on the fly option enabled"));
		if (rtcVersion & 0x20)
			LOG(_T("2nd scan head option enabled"));
		if (rtcVersion & 0x40)
			LOG(_T("3D varioscan option enabled"));

		if ( 0 == cardCnt )
		{
			LOG(_T("rtc4 hardware doesn't detected. so simulation mode activated !"));
			return FALSE;
		}	
	}

	LOG(_T("rtc4 serial no : %d"), n_get_serial_number(_index+1) );
	LOG(_T("scanner k factor = %.6f bit/mm"), kfactor);

	// ctb file load
	CHAR szTempCtbFileName[MAX_PATH]={0, };

#if defined(UNICODE) || defined(_UNICODE)
	::WideCharToMultiByte(CP_ACP, 0, lpszCtbFileName, -1, szTempCtbFileName, MAX_PATH, NULL, NULL );
#else
	_tcscpy(szTempCtbFileName, lpszCtbFileName);
#endif

	_tcscpy(_szCtbFileName, lpszCtbFileName);

	error = n_load_correction_file(_index+1,
			szTempCtbFileName,		// .ctb file 
			1,	// table no (1 or 2)
			1, 1,	//scale
			0, //theta
			0,0 //offset
			);  

	if (0 != error)// File not found, file demaged, and so on
	{
		LOG(_T("fail to load the rtc4 correction file : %d (%s)"), error, RTC4_ERROR_MSG[error][1] );
		return FALSE;
	}
	LOG(_T("correction file loaded : %s"), lpszCtbFileName);

	n_select_cor_table(_index+1, 
		1,		// table no in head A 
		0);		// table no in head B

	LOG(_T("list buffer size : %d"), RTC4_LIST_BUFFER_MAX);

	//fpk
	n_set_firstpulse_killer(_index+1, 0);
	LOG(_T("laser first pulse killer signal : %d us"), 0);

	// stand by
	n_set_standby(_index+1, 
		0,
		0);

	LOG(_T("laser stand by period : %.3f us"), 0 );
	LOG(_T("laser stand by pulse width : %.3f us"), 0 );

	return TRUE;
}
Beispiel #4
0
KHMEXP void KHMAPI
khm_version_init(void) {
    get_dll_version(L"comctl32.dll", &ver_commctl);
}
Beispiel #5
0
// MW-2005-05-15: Updated for new answer command restructuring
int MCA_folder(MCStringRef p_title, MCStringRef p_prompt, MCStringRef p_initial, unsigned int p_options, MCStringRef &r_value, MCStringRef &r_result)
{
	if (MCmajorosversion >= 0x0600 && MCModeMakeLocalWindows())
		return MCA_file(p_title, p_prompt, nil, p_initial, p_options | MCA_OPTION_FOLDER_DIALOG, r_value, r_result);

// MW-2005-05-27: We'll use a static (I know bad me) to store the version
//   of the shell dll.
	static int s_shell_version = -1;
	static MCStringRef s_last_folder = MCValueRetain(kMCEmptyString);

	MCAutoStringRef t_native_filename;

	if (p_initial != NULL)
	{
		MCAutoStringRef t_std_path;

		/* UNCHECKED */ MCS_pathfromnative(p_initial, &t_std_path);
		t_native_filename = *t_std_path;
	}
	else
		t_native_filename = MCValueRetain(s_last_folder);

	if (!MCModeMakeLocalWindows())
    {
		MCAutoStringRef t_answer_path;
		MCRemoteFolderDialog(p_title, p_prompt, *t_native_filename, &t_answer_path);
        if (*t_answer_path != nil)
		{
			MCAutoStringRef t_std_path;

			/* UNCHECKED */ MCS_pathfromnative(*t_answer_path, &t_std_path);
			MCValueAssign(s_last_folder, *t_std_path);
		}
		r_value = MCValueRetain(*t_answer_path);
		return 0;
	}

	if (s_shell_version == -1)
		s_shell_version = get_dll_version(L"shell32.dll");

	bool sheet = (p_options & MCA_OPTION_SHEET) != 0;

	BROWSEINFOW bi;
	memset(&bi, 0, sizeof(BROWSEINFOW));

	Window pw;
	pw = MCModeGetParentWindow();

	if (pw != DNULL)
		bi.hwndOwner = (HWND)pw->handle.window;

	MCAutoStringRefAsWString t_prompt_wstr;
	MCAutoStringRefAsWString t_native_filename_wstr;
	/* UNCHECKED */ t_prompt_wstr.Lock(p_prompt);

	bi.pidlRoot = NULL;
	bi.lpszTitle = *t_prompt_wstr;
	bi.ulFlags = BIF_RETURNONLYFSDIRS;
	if (s_shell_version >= 500)
		bi.ulFlags |= BIF_NEWDIALOGSTYLE;
	if (*t_native_filename != nil && !MCStringIsEmpty(*t_native_filename))
	{
		t_native_filename_wstr.Lock(*t_native_filename);
		
		bi . lpfn = BrowseCallbackProc;
		bi . lParam = (LPARAM)*t_native_filename_wstr;
	}
	else
	{
		bi.lpfn = NULL;
		bi.lParam = NULL;
	}
	LPITEMIDLIST lpiil;
	LPMALLOC lpm;
	SHGetMalloc(&lpm);

	DWORD t_error;
	lpiil = SHBrowseForFolderW(&bi);
	if (lpiil == NULL)
	{
		t_error = GetLastError();
	}
	
	MCAutoArray<unichar_t> t_buffer;
	/* UNCHECKED */ t_buffer.New(MAX_PATH);

	if (lpiil != NULL && SHGetPathFromIDListW(lpiil, t_buffer.Ptr()))
	{
		if (s_last_folder != NULL)
			MCValueRelease(s_last_folder);

		size_t t_length;
		/* UNCHECKED */ StringCchLength(t_buffer.Ptr(), t_buffer.Size(), &t_length);
		/* UNCHECKED */ MCStringCreateWithChars(t_buffer.Ptr(), t_length, s_last_folder);

		MCAutoStringRef t_std_path;
		/* UNCHECKED */ MCS_pathfromnative(s_last_folder, &t_std_path);

		r_value = MCValueRetain(*t_std_path);
	}
	else
		r_result = MCSTR(MCcancelstring);

	//  SMR 1880 clear shift and button state
	waitonbutton();

	lpm->Free(lpiil);
	lpm->Release();

	return 0;
}