When we install our embedded vb application on a pocket pc we also install
files to support the DEVICETODESKTOP and DESKTOPTODEVICE api's. We run an
application from the desktop that uses these api's to copy a *.cdb to the
desktop as a *.mdb, and the reverse. This worked for years with pocketpc
devices. With WM5 we had to install the extra files (ADOCE runtimes), but
this has worked for months on devices with Windows Mobile 5 and Active Sync
4.1 or 4.2. The desktops are XP, W2k, or W2k3.

Recently this has started to fail on some machines. When the desktop app
calls DEVICETODESKTOP we get Error 53, file not found "c:\Program
Files\Microsoft ActiveSync\adofiltr.dll".

We declare the api as follows:

Private Declare Function DEVICETODESKTOP Lib _
"c:\program files\Microsoft ActiveSync\adofiltr.dll" ( _
ByVal desktoplocn As String, _
ByVal tablelist As String, _
ByVal sync As Boolean, _
ByVal overwrite As Integer, _
ByVal devicelocn As String) As Long

We then use it with syntax similar to:

lngReturnValue = DEVICETODESKTOP(App.Path & "\Data.mdb", _
"table1..table2..table2..", _
False, True, strCDBLocation & "Data.cdb")

Per suggestions in an old posting in this newsgroup, we tried declaring the
api with no hard coded path and placing the dll in the same folder as the
exe. We also tried passing a blank string for tablelist (no list of database
tables). We've tried reinstalling everything, but we still get the same
error. We have tried adofiltr.dll version 4.1 and 4.2, and tried with it in
several locations. Our applications (desktop and mobile) have not changed
since Spring.

We fear a recent update has altered security. We can't tell the difference
between installations where this works and where it fails. Any ideas or
suggestions.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

Re: adofiltr file not found error by Richard

Richard
Fri Oct 20 15:53:10 CDT 2006

After more testing we think we see a pattern:

If the mobile device is older than WM5, DeviceToDesktop always works, no
matter what OS is on the desktop.

If the mobile device has WM5, DeviceToDesktop works if the desktop OS is XP.

If the mobile device has WM5, DeviceToDesktop fails if the desktop is W2k or
W2k3.

Any ideas to explain this? Is this due to "RAPI Restricted Mode Security"? I
fear things will be worse on Vista.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"Richard Mueller" <rlmueller-NOSPAM@ameritech.NOSPAM.net> wrote in message
news:On7803F9GHA.1256@TK2MSFTNGP04.phx.gbl...
> When we install our embedded vb application on a pocket pc we also install
> files to support the DEVICETODESKTOP and DESKTOPTODEVICE api's. We run an
> application from the desktop that uses these api's to copy a *.cdb to the
> desktop as a *.mdb, and the reverse. This worked for years with pocketpc
> devices. With WM5 we had to install the extra files (ADOCE runtimes), but
> this has worked for months on devices with Windows Mobile 5 and Active
> Sync
> 4.1 or 4.2. The desktops are XP, W2k, or W2k3.
>
> Recently this has started to fail on some machines. When the desktop app
> calls DEVICETODESKTOP we get Error 53, file not found "c:\Program
> Files\Microsoft ActiveSync\adofiltr.dll".
>
> We declare the api as follows:
>
> Private Declare Function DEVICETODESKTOP Lib _
> "c:\program files\Microsoft ActiveSync\adofiltr.dll" ( _
> ByVal desktoplocn As String, _
> ByVal tablelist As String, _
> ByVal sync As Boolean, _
> ByVal overwrite As Integer, _
> ByVal devicelocn As String) As Long
>
> We then use it with syntax similar to:
>
> lngReturnValue = DEVICETODESKTOP(App.Path & "\Data.mdb", _
> "table1..table2..table2..", _
> False, True, strCDBLocation & "Data.cdb")
>
> Per suggestions in an old posting in this newsgroup, we tried declaring
> the
> api with no hard coded path and placing the dll in the same folder as the
> exe. We also tried passing a blank string for tablelist (no list of
> database
> tables). We've tried reinstalling everything, but we still get the same
> error. We have tried adofiltr.dll version 4.1 and 4.2, and tried with it
> in
> several locations. Our applications (desktop and mobile) have not changed
> since Spring.
>
> We fear a recent update has altered security. We can't tell the difference
> between installations where this works and where it fails. Any ideas or
> suggestions.
>
> --
> Richard
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
>
>
>
>
>
>
>
>
>



copy it by yourself by Ace

Ace
Fri Jan 12 09:43:21 CST 2007

Private Function GetKeyStringValue(ByVal plKey As Long, ByVal psKey As String, ByVal psSubKey As String) As String
Dim llKeyID As Long
Dim llBufferSize As Long
Dim lsKeyValue As String

Const ERROR_SUCCESS = 0&
Const ERROR_MORE_DATA = 234&
Const REG_SZ = 1

GetKeyStringValue = ""

If RegOpenKey(plKey, psKey, llKeyID) = ERROR_SUCCESS Then
If RegQueryValueEx(llKeyID, psSubKey, 0&, REG_SZ, 0&, llBufferSize) = ERROR_MORE_DATA Then
If llBufferSize >= 2 Then
lsKeyValue = String(llBufferSize + 1, " ")
If RegQueryValueEx(llKeyID, psSubKey, 0&, REG_SZ, ByVal lsKeyValue, llBufferSize) = ERROR_SUCCESS Then
GetKeyStringValue = Left(lsKeyValue, llBufferSize - 1)
End If
End If
End If
RegCloseKey (llKeyID)
End If
End Function

Private Sub CheckActiveSync()
Dim ADOFilter As String
On Error Resume Next

ADOFilter = GetKeyStringValue(HKEY_CLASSES_ROOT, "CLSID\{6BDC49D0-54D6-11D1-A0F6-00805FC25DE6}\InProcServer32", "")
If ADOFilter <> "" Then
CopyFile ADOFilter, App.Path + "\ADOFILTR.DLL", False
CopyFile Left(ADOFilter, Len(ADOFilter) - 12) & "MSVCP71.DLL", App.Path + "\MSVCP71.DLL", False
Open App.Path + "\ADOFILTR.DLL" For Input Access Read As #1
If Err.Number = 0 Then
Close #1
Else
ADOFilter = ""
End If
End If
End Sub


EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com