i'm using WEC2013
Posts by bgontek
-
-
Isn't it possible to Format sdcard via ndcucfg? i found command "FAT Format" but it doesn't work. i just get message "Error Formatting SDCard [87]"
thx
-
I could solve Problem, it is just working when i call setport(3) two times!
-
Code
- Imports System.Runtime.InteropServices
- Public Class DIOPort
- ' File access
- Private Const INVALID_HANDLE_VALUE As Integer = -1
- Private Const OPEN_EXISTING As Integer = 1
- Private Const FILE_BEGIN As Integer = 0
- Private hPort As IntPtr = CType(INVALID_HANDLE_VALUE, IntPtr)
- Public Sub New()
- IOport("DIO0:")
- SetPort(3) 'seems not to work
- End Sub
- Public Sub setOnDoesntWork()
- 'Here I want to set just Port3, but iam Setting port0
- Try
- Dim DataArray(0) As Byte
- Dim NumberOfBytesToWrite As UInteger = 1
- Dim NumberOfBytesWritten As UInteger = 0
- DataArray(0) = 255
- Dim value As Integer
- value = CEWriteFile(hPort, DataArray, NumberOfBytesToWrite, NumberOfBytesWritten, IntPtr.Zero)
- If value = 0 Or NumberOfBytesWritten = 0 Then MessageBox.Show("WriteFile Failed")
- Catch ex As Exception
- End Try
- End Sub
- Public Sub setOnWorks()
- 'Here I want to set Port 3, but i am overwriting Port0,1,2
- Try
- Dim DataArray(3) As Byte
- Dim NumberOfBytesToWrite As UInteger = 4
- Dim NumberOfBytesWritten As UInteger = 0
- DataArray(3) = 255
- Dim value As Integer
- value = CEWriteFile(hPort, DataArray, NumberOfBytesToWrite, NumberOfBytesWritten, IntPtr.Zero)
- If value = 0 Or NumberOfBytesWritten = 0 Then MessageBox.Show("WriteFile Failed")
- Catch ex As Exception
- End Try
- End Sub
- Private Sub IOport(ByVal Filename As String)
- Dim Access As UInt32 = 3221225472 '&HC0000000
- hPort = CECreateFileW(Filename, Access, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)
- End Sub
- Private Sub SetPort(ByVal port As Integer)
- Dim value As UInt32
- value = CESetFilePointer(hPort, port, IntPtr.Zero, FILE_BEGIN)
- End Sub
- Public Sub Close()
- Try
- Dim value As Integer
- value = CECloseHandle(hPort)
- Catch ex As Exception
- End Try
- End Sub
- ' P/Invoke calls to DIGITIO.DLL (digital IO driver) via win32 API (coredll.dll)
- ' CreateFileW()
- <DllImport("coredll.dll", EntryPoint:="CreateFileW", SetLastError:=True)> _
- Public Shared Function CECreateFileW( _
- ByVal lpFileName As String, _
- ByVal dwDesiredAccess As UInt32, _
- ByVal dwShareMode As UInteger, _
- ByVal pSecurityAttributes As IntPtr, _
- ByVal dwCreationDisposition As UInteger, _
- ByVal dwFlagsAndAttributes As UInteger, _
- ByVal hTemplatefile As IntPtr) As IntPtr
- ' Leave the body of the function empty.
- End Function
- ' CloseHandle()
- <DllImport("coredll.dll", EntryPoint:="CloseHandle", SetLastError:=True)> _
- Private Shared Function CECloseHandle( _
- ByVal hObject As IntPtr) As Integer
- ' Leave the body of the function empty.
- End Function
- ' Write File()
- <DllImport("coredll.dll", EntryPoint:="WriteFile", SetLastError:=True)> _
- Private Shared Function CEWriteFile( _
- ByVal hObject As IntPtr, _
- ByVal lpBuffer As Byte(), _
- ByVal NumberOfBytesToWrite As UInteger, _
- ByRef lpNumberOfBytesWritten As UInteger, _
- ByVal lpOverLapped As IntPtr) As Integer
- ' Leave the body of the function empty.
- End Function
- 'Read File()
- <DllImport("coredll.dll", EntryPoint:="ReadFile", SetLastError:=True)> _
- Private Shared Function CEReadFile( _
- ByVal hObject As IntPtr, _
- ByVal lpBuffer As Byte(), _
- ByVal NumberOfBytesToRead As UInteger, _
- ByRef lpNumberOfBytesRead As UInteger, _
- ByVal lpOverLapped As IntPtr) As Integer
- 'Leave the body of the function empty.
- End Function
- 'SetFilePointer
- <DllImport("coredll.dll", EntryPoint:="SetFilePointer", SetLastError:=True)> _
- Private Shared Function CESetFilePointer( _
- ByVal hObject As IntPtr, _
- ByVal lDistanceToMove As Integer, _
- ByVal ipDistanceToMoveHigh As IntPtr, _
- ByVal dMovedMethod As ULong) As UInteger
- ' Leave the body of the function empty.
- End Function
- End Class
-
Hello Support,
i have following Problem by set the dio port:
- My DIO Port is working but now i have the Situation that i just want to set port 3. I am using the setFIlePointer Methode but it doesn't work and i think i do something wrong.Reg Settings:
reg open \Drivers\BuiltIn\DIGITALIO
reg set val Port DWord 0
reg set val Index DWord 0
reg set val UseAsIO hex fc,01,fc,01
reg set val DataDir hex fc,01,fc,01
reg set val DataInit hex 00,00,00,00
reg save -
Hello,
following question: i have a touch Controller (4-wire) with an Adapter and wan't to connect to the Interface. is the Interface always active for signals (i load the calibration tool), cause in every case i dont get a Signal. Note: i'm just loading the Default starter kit Drivers for EDT Display/Touch?!
-
Where is the location in registry for background image?
I can't find:[HKEY_CURRENT_USER\ControlPanel\Desktop]
"wallpaper"="\Windows\WindowsCE.bmp"i know that i have to use 'reg opencu'
-
you need a key for authentification not a cert. when you use the offical MS example, it is just possible to autheticate by key! the cert is just important to sign the key
http://msdn.microsoft.com/en-us/library/bb629363.aspx -
try a key (.pvk) !
-
Small Question:
is it possible that Baudrate 1200 (8,N,1) is not supported? 19200Baud(8,N,1) works perfect, but it seems that the RTS/CTS Signal doesn't work for 1200 baud. The received Byte size is not right in length and i got a lot of CRC mistakes? Note: I'm working with RS485 Converter
-
ok i got it!!!
That works for self signed certs:
1. use the code on top to Import pfx file in my certs
2. now you have an unsigned key, although you have import a root cert
3. i don't found a way to sign the cert, but that is not important in embedded, beacause it is isolated anyway. Forget the root cert!
4. set the cert like that (vb.net):cc = New ClientCredentials
cc.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "subjectname")and now tell the System to trust the unsigned certs:
create class:
Imports System
Imports System.Net
imports System.Security.Cryptography.X509CertificatesPublic Class TrustAllCertificatePolicy
Implements System.Net.ICertificatePolicyPublic Sub New()
MyBase.New()
End SubPublic Function CheckValidationResult(ByVal sp As ServicePoint, ByVal cert As X509Certificate, ByVal req As WebRequest, _
ByVal problem As Integer) As Boolean Implements ICertificatePolicy.CheckValidationResult
Return True
End Function
End Classand put following under the set cert method:
cc = New ClientCredentials
cc.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "subjectname")
System.Net.ServicePointManager.CertificatePolicy = New TrustAllCertificatePolicy()thats it!
-
the Problem is that the root cert does not certificate the Client cert. arrrggggg
-
here is a list with dwFlags for wince5 but i don#t no how to implement
-
Imports System.IO
Imports System.Runtime.InteropServicesPublic Class Crypto
#Region "CONSTS"
Public Const CERT_STORE_ADD_REPLACE_EXISTING As Int32 = 3
Public Const CERT_STORE_PROV_SYSTEM As Int32 = 10
Public Const CERT_SYSTEM_STORE_CURRENT_USER_ID As Int32 = 1
Public Const CERT_SYSTEM_STORE_LOCATION_SHIFT As Int32 = 16
Public Const CERT_SYSTEM_STORE_CURRENT_USER As Int32 = CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT#End Region
#Region "STRUCTS"
<StructLayout(LayoutKind.Sequential)> _
Public Structure CRYPT_DATA_BLOBPublic cbData As Integer
Public pbData As IntPtrEnd Structure
<StructLayout(LayoutKind.Sequential)> _
Public Structure CERT_CONTEXTPublic dwCertEncodingType As UInteger
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=2)> _
Public pbCertEncoded As Byte()Public cbCertEncoded As UInteger
Public pCertInfo As IntPtr
Public hCertStore As IntPtr
End Structure
#End Region
#Region "FUNCTIONS (IMPORTS)"
<DllImport("Crypt32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function CertOpenStore(storeProvider As Integer, dwMsgAndCertEncodingType As UInteger, hCryptProv As IntPtr, dwFlags As UInteger, cchNameString As [String]) As IntPtr
End Function<DllImport("Crypt32.dll", SetLastError:=True)> _
Public Shared Function PFXImportCertStore(ByRef pPfx As CRYPT_DATA_BLOB, <MarshalAs(UnmanagedType.LPWStr)> szPassword As [String], dwFlags As UInteger) As IntPtr
End Function<DllImport("Crypt32.dll", SetLastError:=True)> _
Public Shared Function CertAddCertificateContextToStore(hCertStore As IntPtr, pCertContext As IntPtr, dwAddDisposition As Int32, ByRef ppStoreContext As IntPtr) As [Boolean]
End Function<DllImport("Crypt32.DLL", SetLastError:=True)> _
Public Shared Function CertEnumCertificatesInStore(storeProvider As IntPtr, prevCertContext As IntPtr) As IntPtr
End Function<DllImport("Crypt32.dll", SetLastError:=True)> _
Public Shared Function CertCloseStore(hCertStore As IntPtr, dwFlags As Int32) As [Boolean]
End Function#End Region
End Class
Namespace ImportCert
Public Class PFXImport
Friend Shared Function ReadFile(fileName As String) As Byte()
Dim f As New FileStream(fileName, FileMode.Open, FileAccess.Read)
Dim size As Integer = CInt(f.Length)
Dim data As Byte() = New Byte(size - 1) {}
size = f.Read(data, 0, size)
f.Close()
Return data
End Function
Public Shared Sub Import(args As String())
If args.Length < 2 Then
Console.WriteLine("Usage: ImportCert <PFX filename> password")
Return
End IfTry
Dim hCryptProv As IntPtr = IntPtr.Zero
Dim hCertStore As IntPtr = Crypto.CertOpenStore(Crypto.CERT_STORE_PROV_SYSTEM, 0, hCryptProv, Crypto.CERT_SYSTEM_STORE_CURRENT_USER, "MY")
If hCertStore <> IntPtr.Zero Then
Dim rawData As Byte() = ReadFile(args(0))
Dim ppfx As New Crypto.CRYPT_DATA_BLOB()
ppfx.cbData = rawData.Length
ppfx.pbData = Marshal.AllocHGlobal(rawData.Length)
Marshal.Copy(rawData, 0, ppfx.pbData, rawData.Length)
Dim hMemStore As IntPtr = Crypto.PFXImportCertStore(ppfx, args(1), 0)
If hMemStore <> IntPtr.Zero Then
Dim pctx As IntPtr = IntPtr.Zero
Dim pStoreContext As IntPtr = IntPtr.Zero
While IntPtr.Zero <> (InlineAssignHelper(pctx, Crypto.CertEnumCertificatesInStore(hMemStore, pctx)))
Crypto.CertAddCertificateContextToStore(hCertStore, pctx, Crypto.CERT_STORE_ADD_REPLACE_EXISTING, pStoreContext)
End While
Crypto.CertCloseStore(hMemStore, 0)
End IfCrypto.CertCloseStore(hCertStore, 0)
End If
Catch e As Exception
Console.WriteLine(e.Message)
End TryEnd Sub
Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
target = value
Return value
End FunctionEnd Class
End Namespace -
i found a code in vb.net where it is possible to Import by pinvoke to set pfx in Windows store. when i try it the key appears in list and i can find the key via
cc = New ClientCredentials
cc.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "wcf.gon-tech.com")but the Server does not accept the key. on Desktop it works! maybe it helps you to solve the problem
-
hmmm ok, but i don't think for wcf Server. i think it makes no difference with which tool I create the certificate, perhaps they will do it through other ways.
I'm using the offical MS way for Transport security and basic http binding:
http://msdn.microsoft.com/en-us/library/bb629363.aspxi tried a lot of tricky methods, but no success. other Forums says that it is just possible over Windows cert store!
https://social.msdn.microsoft.…ork-35?forum=netfxcompact
http://stackoverflow.com/quest…net-compact-framework-3-5nobody could solved the Problem
-
?????
I searched for other ways to Import it, but in .net compact Framework it is just possible to use the way over the Windows Cert Store.
// Specifies the X.509 certificate used by the client.
ClientCredentials cc = new ClientCredentials();
cc.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "testuser");
parameters.Add(cc);When i try to Import it via byteArray, it is not possible in compact Framework , just in Desktop Framework. Other ways ????
We need secure connection to Server, to finalize out project!!!! -
I tried to Import a SSL Client Certificate on ARMStone A5 (WEC2013) and i have following problem:
First Way (GUI):
- I tried it over the 'System Control' way by GUI and i could successfully implement my Root Cert in 'Trusted Authorities'
- after that, i want to implement my Client Cert (pvk) im 'My Certificates', but after i type in my Import Password the key does not appear in list and it doesnt work in application
Second Way (ndcucfg):
- when i try it over ndcucfg, i just got a sequenze of that:
Please enter Password:Please enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter passwordPlease enter password......and it is not possible to enter
????
Note:
First I debug the code and the cert on a Desktop System where it is working perfect. Iam absolut sure that everything is right with code, Cert and Connection to Server!!!! -
OK, deleting the dll works fine.
-
Is it possible to disable the Software Input Panel (Keyboard) from Windows permanent in registry. I know that it is possible to disable it by code in .Net, but it works not in every case perfect.