SetDriverString

Declaration

Delphi

function SetDriverString(Key: Integer; Value: PChar): Cardinal;

C/C++

SOPAD_API void SOPAD_SetDriverString(DWORD dwKey, const char* szValue);

ActiveX

HRESULT SetDriverString([in] long Key, [in] BSTR Value);

Description

This function sets string parameters of the driver.

Arguments

Key

Numerical value, must be equal to one of possible values from the table (see below).

szValue

String value which corresponds to the Key.

Possible combinations of key and value

Possible combinations of key and value are listed int the table.

KeyValue
3XML certificate
4Page number string (for color devices)
5Device public key 1
6Name of resource which will be overridden by the next call of SetDriverBin, key=1
7Overrides device name
8Overrides i18n variables (for internal use)
9

Set the Password for Virtual hosted WLAN (SMARTPhone with soWifiCom.dll ) . When using a empty string the password will be set automatically.

10

Set the SSID name for Virtual hosted WLAN (SMARTPhone with soWifiCom.dll ). When using a empty string the SSID will be set automatically.

 

Sample

 

C#
// Load driver-certificate (XML) to avoid warning at the start about uncertified Application
 
XmlDocument myXml = new XmlDocument();      
myXml.Load(@"C:\temp\cert.xml");

SigDev.SetDriverString(3, myXml.InnerXml);
 
C++
void  CDeviceAPIDlg::OnBnClickedLoadDriverCert()
{
	
	OPENFILENAME oFname;
	memset(&oFname, '\0', sizeof(oFname));
	
	TCHAR fileName[MAX_PATH];
	wcsncpy_s( &fileName[0], _countof(fileName), L"drivercert.xml",_TRUNCATE);
	
	DWORD dlgError = 0;
	
	
	TCHAR szDirPath[ MAX_PATH ];
	
	DWORD nChars = GetModuleFileName( NULL, szDirPath, _countof(szDirPath) );
	PathRemoveFileSpec(&szDirPath[0]);
	oFname.lpstrTitle = L"Open CERT XML-file";
	oFname.lStructSize = sizeof(oFname);
	oFname.lpstrFile = fileName;
	oFname.nMaxFile = _countof(fileName);
	oFname.lpstrFilter = L"XML Cert files (*.xml)\0*.xml\0All files (*.*)\0*.*";
	oFname.nFilterIndex = 2;
	oFname.Flags = OFN_PATHMUSTEXIST;
	oFname.hwndOwner = NULL;
	oFname.lpstrInitialDir = &szDirPath[0];
	
	CString TitleText;
	GetWindowText(TitleText);
	
	MessageBox( L"to avoid warning at the start about uncertified Application\nselect corresponding XML-Certificate\n\nmore infos at:\n https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate", TitleText , MB_OK|MB_ICONASTERISK);
	
	if (GetOpenFileName(&oFname)== TRUE)
	{
        
		//  load driver-certificate (XML) 
 		
		char *strXML = NULL;
		LPWSTR lpwstrXML = NULL;
		CFile XMLfile ;
		
		if (XMLfile.Open( oFname.lpstrFile, CFile::modeRead))
		{
			int len = (int) XMLfile.GetLength();
			strXML	  = (char *) malloc(len+1);
			lpwstrXML = (LPWSTR) malloc((len+1) << 1);
			
			XMLfile.Read(strXML, len);
			XMLfile.Close();
			strXML[len] = '\0';
			MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,(LPCSTR) strXML,len+1,lpwstrXML,len+1);
			SigDev.SetDriverString(DRIVER_STRING_XML_CERT,(LPCTSTR) lpwstrXML );
			free(lpwstrXML);
			free(strXML);
		} 
	else { 
	   /*
            *    to avoid warning at the start about uncertified Application more infos about that under:
            *    https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate
            */	
	    MessageBox( (LPCWSTR) L"Something went wrong see:\n https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate", TitleText , MB_OK|MB_ICONASTERISK);
        }
    }
}
 
Delphi
procedure TForm1.ButtonLoadDriverCERTClick(Sender: TObject);
var
    ofd : TOpenDialog;
    fn  : String;
    myXml : TXmlDocument;
    XMLText : String;
begin
    ofd             := TOpenDialog.Create(Self);
    ofd.FileName    := 'drivercert.xml';
    ofd.Filter      := 'XML Cert files (*.xml)|*.xml|All files (*.*)|*.*';
    ofd.InitialDir  := ExtractFilePath(Application.ExeName);
    MessageBox(Self.Handle,('to avoid warning at the start about uncertified Application'#13#10'select corresponding XML-Certificate'#13#10#13#10'more infos at:'#13#10' https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate'), PChar(Text), MB_OK);
    if ofd.Execute then
    begin
        fn := ofd.FileName;
        try
            //  load driver-certificate (XML)
            myXml := TXmlDocument.Create(Self) ;
            myXml.LoadFromFile(fn);
            myXml.SavetoXML(XMLText);
            SigDev.SetDriverString(DRIVER_STRING_XML_CERT, Widestring(XMLText));
        except
            (*
             *    to avoid warning at the start about uncertified Application more infos about that under:
             *    https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate
             *)
            MessageBox(Self.Handle,PChar('Something went wrong see : https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate'), PChar(Text), MB_OK);
        end;
    end;
end;
vb.NET
     Private Sub LoadDriverCERT_Click(sender As System.Object, e As System.EventArgs) Handles LoadDriverCERT.Click
        Dim ofd As New OpenFileDialog()         ofd.FileName = "drivercert.xml"
        ofd.Filter = "XML Cert files (*.xml)|*.xml|All files (*.*)|*.*"
        ofd.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory         MessageBox.Show("to avoid warning at the start about uncertified Application" & vbCrLf &
                        "select corresponding XML-Certificate"& vbCrLf & vbCrLf &
                        "more infos at:" & vbCrLf &
                        "https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate", Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk)         if (ofd.ShowDialog() = DialogResult.OK) then
            Dim fn As String = ofd.FileName             Try
                '  load driver-certificate (XML) 
                Dim myXml As New XmlDocument()                 myXml.Load(fn)
                AxStepOverSignatureDevice1.SetDriverString(DRIVER_STRING_XML_CERT, myXml.InnerXml)
            Catch
                '
                '    to avoid warning at the start about uncertified Application more infos about that under:
                '    https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate
                '
                MessageBox.Show("Something went wrong see :" & vbCrLf & 
                                "https://www.stepoverinfo.net/confluence/display/SDDP/StepOver+XML+Certificate", Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
            End Try
        End If
    End Sub