Windows CE Embedded Live Chat! (January 26, 2010)
Chat Topic: Windows CE Embedded Live Chat!
Date: Tuesday, January 26, 2010
Please note: portions of this chat have been edited for clarity.*
Start of chat:
davbo_msft (Moderator):
Q: I am a new .NET developer for Windows Mobile. is it possible to ask some questions about WM and .NET here?
A: We can handle .NET Compact Framework questions related to Windows CE Embedded. We don't have specific knowledge of .NET related to Windows Mobile.
davbo_msft (Moderator):
Q: Is there a remote Desktop server (ie the CE system is the one being watched) for WinCE 6.0
A: If you are looking for a system management solution for Windows CE devices then you can use SCCM. https://www.microsoft.com/systemcenter/configurationmanager/en/us/default.aspx. SCCM allows management, download apps, system configuration, and other related admin tasks.
davbo_msft (Moderator):
Q: Not interested in Win Mobile, Win32 API developer
A: If you are looking for a system management solution for Windows CE devices then you can use SCCM. https://www.microsoft.com/systemcenter/configurationmanager/en/us/default.aspx. SCCM allows management, download apps, system configuration, and other related admin tasks.
kurtken_msft (Expert):
Q: Are questions regarding aygshell.dll relevant here, or is that strictly Mobile? Especially regarding ShFullScreen.
A: What version of Windows CE are you referring to here?
kurtken_msft (Expert):
Q: I developed an SD Host driver for my IP that is based on SDBus/SDMemory MS modules. I need to support deepsleep feature that
recovering data transfer ongoing before deepsleep on SD after the resume of the system. Is it something feasible in your opinion?
A: I do not believe this is feasible since a deep sleep will power down bus connections and any ongoing data transfer will have ended.
Sue Loh [MS] (Moderator):
Q: Is there a way to do screen grabs (like ctrl+prnScr on windows desktops) of the CE machine from the debug machine?
A: You can use Remote Spy, I believe. You'll find it in your Start menu under Visual Studio -> VS Remote Tools. There are also some third-party tools which will do this.
kurtken_msft (Expert):
Q: Regarding AYGShell, it's on WM6.5
A: This chat is aimed at Windows Embedded CE. Subject matter experts for WM are not present at this time.
Sing Wee [MS] (Expert):
Q: Is there a way to do screen grabs (like ctrl+prnScr on windows desktops) of the CE machine from the debug machine?
A: In addition to the Remote Zoom tool, if you're at a breakpoint, you can also execute "!screenshot" from the Target Control window, and that will invoke CEDebugX to get you a screenshot.
Sohel_MSFT (Expert):
Q: I would like to know why replacing the Floating point run time library is not avaliable for MIPS, or if it is planned for the future.
A: Can you elaborate a little bit on replacing the FP library? Exactly what are you trying to do?
Sue Loh [MS] (Moderator):
Q: A question related to the memory usage in WCE 6.0. If I set the kernel pooling in the following way
kernel.dll:LoaderPoolTarget 00000000 00A00000 FIXUPVAR
kernel.dll:LoaderPoolMaximum 00000000 01400000 FIXUPVAR
at boot If I check mydevice\control panel\system->memory I can see that the program memory allocated it around 10MB.
If I remove the pooling in the config.bib I don't see these 10 MB allocated.
Can you explain this behaviour?
A: Yeah, the "target" value is preallocated to guarantee you can reach that - if you want it to use less memory, lower the LoaderPoolTarget value. You can find more descriptions here: https://blogs.msdn.com/ce_base/archive/2008/01/19/Paging-and-the-Windows-CE-Paging-Pool.aspx
kurtken_msft (Expert):
Q: I'm developing some applications that use SQLCE both natively, and in .NET. In my %program files%/Microsoft SQL Server Compact Edition/v3.5/Devices folder there are a number of CAB files and DLL's. How do I know what to install with my application?
A:https://msdn.microsoft.com/en-us/library/ms172361.aspx
kurtken_msft (Expert):
Q: I'm developing some applications that use SQLCE both natively, and in .NET. In my %program files%/Microsoft SQL Server Compact Edition/v3.5/Devices folder there are a number of CAB files and DLL's. How do I know what to install with my application?
A: That link may be able to help you.
kurtken_msft (Expert):
Q: Is there a tutorial or some guidence for running the emulator under 6.0 R3 inside VS2005
A: Are you referring to the Device Emulator platform?
kurtken_msft (Expert):
Q: Yes Device Emulator.
A: Device Emulator can be used much like any other platform. You select its BSP when you create your OS design project. Are you having trouble using it?
kurtken_msft (Expert):
Q: Does the thread execution quanta vary between versions of CE? I have a .NET program that calls QueueUserWorkItem to process an SQL CE query in the thread pool, and have a UI handler that handles a change from an edit control that sets a boolean that stops the processing of the query. the edit control fires its changed notification, I often find that many (>300) rows have been processed, despite changing the edit control almost instantly after firing off the first query. Can the execution quanta be changed?
A: You can use CeSetThreadQuantum (https://msdn.microsoft.com/en-us/library/ms885156.aspx)
Sue Loh [MS] (Moderator):
Q: Does the thread execution quanta vary between versions of CE? I have a .NET program that calls QueueUserWorkItem to process an SQL CE query in the thread pool, and have a UI handler that handles a change from an edit control that sets a boolean that stops the processing of the query. the edit control fires its changed notification, I often find that many (>300) rows have been processed, despite changing the edit control almost instantly after firing off the first query. Can the execution quanta be changed?
A: This kind of issue isn't really best served by changing the thread quantum. Race conditions will exist no matter what. Thread priority is a better way to go.
kurtken_msft (Expert):
Q: Yes, When I attach device it doesn't connect. The screen flickers and VS2005 returns to development mode.
A: Go to "Target" -> "Connectivity Options..." and make sure you have your project set up to "Kernel Download" and "Kernel Transport" to be "Device Emulator (DMA)"
kurtken_msft (Expert):
Q: USB HID Device Driver: I have a race condition that I am having problems resolving when the USB device is unplugged - my HID driver exposes a COM port interface and implements the WaitCommEvent IOCTLs. When the device is unplugged I get a HID_CLOSE_DEVICE notification through the HIDDeviceNotifications() API. This then calls DeactivateDevice(). If an application thread is waiting for a character using WaitCommEvent() this thread raises an exception (because the driver is now unloaded). Any suggestions for breaking this race condition? I've tried releasing the wait event and put some interlocks around it but it still apears that the app thread is inside the driver when it is unloaded. Are device notifications the answer (AdvertiseInterface(), etc)?
A: I believe you can use SetCommEvent or EscapeCommFunction to get a thread that is not in WaitCommEvent to make a thread that is in it break out. In that case you can wait for your function to leave the driver before the device deactivation.
Sue Loh [MS] (Moderator):
Hi folks, just a reminder to click "Ask the Experts." That ensures we can't miss your question and makes it easier for us to answer with our chat tool.
Travis Hobrla [MS] (Expert):
Q: When using a multiple-XIP kernel image, what will be the best practice for writing an update routine running on windowsCE itself? The first problem is that the BINFS parition by default is not accessible within regular application. Additionatly I am not sure of there might be any inconsistency problems when updating the nand image during runtime.
A: Typically you don't want to use a normal CE application to perform the update, but instead this is done by setting a special flag or argument in memory, rebooting the device, and running the bootloader which will respond to the special update flag.
Sue Loh [MS] (Moderator):
Q: Can you explain the differences between a WARM boot and and a Cold boot? For the Warm boot I set the program counterat the "Start" Address and I do not call the NKForceCleanboot() in the OEMInit. Is it correct or I'm missing something?
A: People are not very clear about terminology sometimes. This link may help, though a lot of people don't follow the same terminology I do. https://blogs.msdn.com/ce_base/archive/2005/06/22/431699.aspx
kurtken_msft (Expert):
Q: Can you explain the differences between a WARM boot and and a Cold boot? For the Warm boot I set the program counterat the "Start" Address and I do not call the NKForceCleanboot() in the OEMInit. Is it correct or I'm missing something?
A: A cold boot typically re-loads the OS and all data from the persistent storage. A warm boot typically uses as much valid information as it can from the previous iteration of the OS run. This would mean that the OS code is not loaded and data files that do not have to be pulled from persistent storage are not accessed.
kurtken_msft (Expert):
Q: I have the following define : #define GPIO_2_MASK 1 << 2 so bit rapresentation is 100 (4 hex)....if I execute ~GPIO_2_MASK to get binary rapresentation 011 (3 hex)...the result is fffffff8 !! Why ??
A: Try this: #define GPIO_2_MASK (1<<2)
Travis Hobrla [MS] (Expert):
Q: What is the difference beetwen #define GPIO_2_MASK 1 << 2 and #define GPIO_2_MASK (1 << 2) ?
A: To follow up on what Kurt said, your version basically does this: (~1) << 2, which is 0xfffffffe << 2 which gives you your result. What you really want is ~(1 << 2)
kurtken_msft (Expert):
Q: Thanks Ken. But what I'm doing for the WARM boot is it correct or not?
A: If this is an ARM platform you *may* be able to jump to the reset vector (address 0) to do a warm boot. It depends on your platform-specific initialization code and whether it supports detection and the route to a WARM boot without clobbering information that may be in RAM from the previous boot.
davbo_msft (Moderator):
Q: Are these chats archived somewhere?
A: The transcript of today’s chat will be posted online as soon as possible, to <https://msdn.microsoft.com/en-us/chats>. We’ll see you again for another chat next month. Please check <https://msdn.microsoft.com/en-us/chats> for the list of upcoming chats.
If you still have unanswered questions, let me suggest that you post them on one of our newsgroups on
<https://msdn.microsoft.com/en-us/windowsembedded/ce/default.aspx>
Travis Hobrla [MS] (Expert):
Q: What is the difference beetwen #define GPIO_2_MASK 1 << 2 and #define GPIO_2_MASK (1 << 2) ?
A: The problem is that without parentheses in your #define, it will be placed in the code as-is and the order of operations may get messy - any operator that takes precedence over << will result in something incorrect because it will be applied to the 1 before the left-shift by 2 occurs.
Sue Loh [MS] (Moderator):
Q: Regarding the thread Quantum, is it safe to call GetThreadQuantum, change it while my tasks runs as a UserWorkItem, and change it back when my task completes?
A: This is "safe" in that it won't make anything worse, but it is not "safe" if you're looking for a real behavior guarantee. Thread priority is better for that. What is important is not the thread switch time anyway, is it? What's important is how often the database processing code checks for your quit signal. That could be many times per thread quantum, or once per 10 thread quantums, depending on how it's written. I wouldn't be 100% certain that changing the quantum would make any difference at all for your case.
kurtken_msft (Expert):
Q: Is there a whitepaper that talks about CE security and vulnerability to virus attacks?
A: Typically Windows CE is used in a "closed-box" system where third party applications are from known, trusted sources. To answer your question, you can look online on MSDN for information regarding the Loader Verifier (LVMOD) module. Also, it is possible if you have a browser in your CE image to have it download a malicious plug-in. In this case you must still use LVMOD to check to see if you want to let a DLL run.
Sohel_MSFT (Expert):
Q: What is the difference beetwen #define GPIO_2_MASK 1 << 2 and #define GPIO_2_MASK (1 << 2) ?
A: The compiler expands #defines as a literal expansion. So when you use GPIO_2_MASK anywhere in your program, it is replaced with 1 << 2 literally. That way ~GPIO_2_MASK becomes ~1 << 2 and ~ takes precedence over <<.
Sue Loh [MS] (Moderator):
Q: if so, how do I get the handle to the thread from the QueuedWorkItem under .NET
A: I don't believe .NET APIs typically expose the thread handle, so you might need to use native code to do something like that. And figuring out which thread you're looking for would be pretty tough if you can't make the thread run any of your own code.
kurtken_msft (Expert):
Q: USB HID Device Driver: (kurtken) I'm already using SetCommMask() in the app to escape from the WaitCommEvent under normal program execution. The problem is that it's the driver that's notified that the device has been unplugged and is attempting to release the waiting threads - but at the moment it has no way to tell when it is safe to unload the driver. My idea is to call AdvertiseInterface() so that the driver informs the App that the interface is about to disappear, but other than waiting for the app to close all the file open handles I have no way of knowing when the app threads are out of driver memory space. After I call AdvertiseInterface(), is there any way of the driver knowing that this has been acted on by an application?
A: I believe that you would have to track how many foreign threads are in your driver and just wait for them to get out. You can disallow threads from entering the driver but ones that are already in there you have to wait for them to leave.
Sue Loh [MS] (Moderator):
Q: Is there a way to know the inherated priority of a thread? I think CeGetThreadPriority returns the base priority.
A: No, there's no API for that. Why do you want that? (Usually it means you're doing something too complicated)
kurtken_msft (Expert):
Q: What is the difference beetwen #define GPIO_2_MASK 1 << 2 and #define GPIO_2_MASK (1 << 2) ?
A: i believe this was answered. But in case it was not, the #define is expanded literally and ~GPIO_2_MASK becomes ~1 << 2. which is 0xFFFFFFFF << 2, which is 0xFFFFFFFC
Sohel_MSFT (Expert):
Q: What is the difference beetwen #define GPIO_2_MASK 1 << 2 and #define GPIO_2_MASK (1 << 2) ?
A: Also, note that just adding the parentheses won't give you the 3 you expected. The compiler uses an int representation and thus (1 << 2) becomes 0x00000004 and so ~(1 << 2) will become 0xfffffffb. If you only care about the least significant 3 bits, you would have to do a masking e.g. ~GPIO_2_MASK & 0x7 which would give you 0x03.
Sue Loh [MS] (Moderator):
Q: Will CEGetThreadQuanum work with the Pseudo handle returned by GetCurrentThread?
A: Yeah, I believe so. Otherwise try GetCurrentThreadId.
Sue Loh [MS] (Moderator):
Q: Sue Loh: I tried following your terminology link, but get messages saying it no longer exists:-(
A: Strange! It works for me! I'll re-post just in case something was messed up: https://blogs.msdn.com/ce\_base/archive/2005/06/22/431699.aspx
kurtken_msft (Expert):
Q: Ken. It is ARM based, I can perform a SW reset on my specific CPU, just before resetting the CPU I clean the data cache, I switch off the MMU annd I put the DDR in self refresh I reset the CPU and I set the program counter to the start address. There is any kind of rules or suggestion provided by MS to perform a warm boot?
A: It's Kurt. :) The only guidance MS can provide is to not clean any RAM contents during boot in the boot loader. Many boot loaders start out by clearing RAM, and if they do not check for a WARM boot in progress before they do so, then they will clobber RAM contents.
Sue Loh [MS] (Moderator):
Q: Sue Loh: I tried following your terminology link, but get messages saying it no longer exists:-(
A: It was a post called "Boot Persistence Terminology"
kurtken_msft (Expert):
Q: Is there any other way to erase all the partitions instead of using FormatStore? FormatStore takes more than 6 minutes in my board with 64MB of ROM.
A: If you are wanting to completely obliterate the volume, you can probably use raw disk IO to clear out the first megabyte of the volume, where the partition table and file system headers would most likely be. This will work for FAT disks.
mskim_MSFT (Expert):
Q: However the R3 Rollup fails with Target Processor Not Installed although it clearly is (as the platform builds and runs.) and has been since the original install. I was wondering if anyone has success or failure with the R3 Rollup or if we just have to re-install the tools. We've done VS2005, VS2005 SP1, PB6, PB6 SP1, PB6 R2, R2 QFEs until December 2008, R3 Update.
A: What platfrom(BSP) are you using?
davbo_msft (Moderator):
Q: In our device we are planning to use RAPI apis for updating the firmware on the flash memory.With the help of active sync we are able to achieve our goal.My question is there anyway i can avoid active sync synchronization on the HOST PC side?
A: MSDN Active Sync: https://msdn.microsoft.com/en-us/library/aa913903.aspx. Desktop Registry Settings there is an "Enabled Sync" registry setting that you can use for disabling the sync process https://msdn.microsoft.com/en-us/library/aa917326.aspx
Sue Loh [MS] (Moderator):
Q: It is just to clearly understand the way priority inheritance is implemented. As it is not the full protocol, i would like to see by myself in what circumstances the priority is raised or not
A: Ahh, I see. You can also watch thread priority changes with Remote Kernel Tracker. And debug printing works too, if you're just trying stuff out.
kurtken_msft (Expert):
Q: Sorry Kurt (A) ... I have also the control of the bootloader so I can check if I'm coming from a cold boot, from a deepSleep or from a warm boot. So I should have all the ingrediets to have warm boot working on my device :-)
A: Yes. Most CPUs have a "Reset cause Register" which can tell you if you have warm booted.
kurtken_msft (Expert):
A: However, if you are just jumping to the reset vector you may not be able to determine the warm boot that easily.
Sue Loh [MS] (Moderator):
Q: I tried writing a pinvoke as [DllImport("coredll.dll"] internal static extern IntPtr GetCurrentThreadId() ; , but I get "Can't find an Entry Point 'GetCurrentThreadId' in a Pinvoke DLL coredll.dll. when I try to call it.
A: I see. It looks like that function is a macro / inline instead of a coredll export. :-(
kurtken_msft (Expert):
Q: DeactivateDevice(): When DeactivateDevice() is called with file open handles still open, what does WinCE do when an app attempts to use these handles after the device driver is unloaded? 8-)
A: All open handles should become invalidated if the driver has been forcibly unloaded, or the device manager should not be have been unloaded until those handles are closed.
Travis Hobrla [MS] (Expert):
Q: I´m availing if it would be better to push the floating operations to a special coprocessor. My MIPS processor does not support floating point, and the floating point emulation is not good enough for me. So, I was trying to replace the FPCRT, but saw that it was limited for ARM processors.
A: Unfortunately, we don't have a similar mechanism to FPCRT for MIPS. What you're looking for isn't possible using just the public code, so you'd need to engage with PSS to either get a fix or access to the coredll code, at which point you could take a similar approach to ARM.
mskim_MSFT (Expert):
Q: We're using an ARM platform that we originally purchased from Adeneo.
A: Can you send your email alias to mskim@microsoft.com? I'd like to grab the setup log to gather what's happeing in your enviroment.
mskim_MSFT (Expert):
Q: We're using an ARM platform that we originally purchased from Adeneo.
A: Can you also specify the model number?
Sue Loh [MS] (Moderator):
Q: It appears that there is also AppDomain.GetCurrentThreadID, but it is now marked as obsolete, because the thread may be using lightweight fibers. Does the CE compact framework use Fibers, or is this call available?
A: I don't know much about the internal implementation of .NET, but I would suspect that you won't be using fibers unless you explicitly create them yourself.
kurtken_msft (Expert):
Q: DeactivateDevice(): Not sure that really answers my question. This relates to USB HID device again. When device is removed the driver will be deactivated (in my current paradigm, which may be wrong). This causes XXX_Deinit() to be run which forcibly closes all internal file open handles within the driver. However, the app may (does, at the moment) have handles that it thinks are valid (it called CreateFile() and hasn't yet called CloseHandle()). So if it now attempts a DeviceIOControl(), will this fail gracefully or is DeviceManager in a confused state (CE6, if that matters)?
A: Sorry. I believe that device manager will fail the call (gracefully), since it has forcibly unloaded the driver due to a DeactivateDevice call.
Travis Hobrla [MS] (Expert):
Q: Is Wince supports USB Device Firmware Update(DFU) class?Is there any generic way for firmware update using USB in wince?
A: I don't think this class is supported out-of-the-box, you would have to write your own class driver for it.
Sue Loh [MS] (Moderator):
Q: For what reason are the system calls implemented as memory faults instead of using a dedicated instruction (like "swi" on arm cpus)?
A: Well I don't know exactly what all the issues would be, but I know that pretty smart people worked on that. :-) I would hazard to guess that either the exception lets you pass along the API ID as a parameter, or it lets you get into a privileged kernel mode that software interrupts don't, or it's more secure. Maybe something in the description on https://blogs.msdn.com/ce\_base/archive/2006/02/02/Inside-Windows-CE-API-Calls.aspx would help you see something that happens during the call-in or return, that would not be possible with software interrupts.
kurtken_msft (Expert):
Q: Are there any alternative, or source code for the Storage Manager functions? Sometimes I cannot delete a partition using DeletePartiton() and have no idea why. (I unmount it first, it unmounts with success)
A: Are there other partitions on the volume? There are some USB jump drives that cannot have their one and only partition deleted, even by desktop windows. Is it a USB jump drive you are having the problem with?
kurtken_msft (Expert):
Q: Can i avoid the file browsing on the host PC side when active sync is selected on the device?
A: hi Prabu. ActiveSync is a higher-level transport connects with parts of the windows shell. The point of the transport is to facilitate open desktop<->device connectivity. I do not think you can prevent particular applications on the desktop from using the transport. The access to the file system on the device side is necessary for sync and other basic facilities to work, so I think it will be difficult or impossible to disable that functionality.
Sing Wee [MS] (Expert):
Q: Ok, you guys are my last resort and I am not sure if I am in the right environment. here is my issue. I have a Dell laptop (only 2 years old and my boss has one only a year old. they are both having the same problem. The problem is that when we take the laptop home or to a hotel or someplace like panera bread, the computer will show that we are connected to the internet but we cannot access any webpages. I have done all the DNS flushing etc. We can ping the IP address but when we type in www.google.com it will not ping. I have called every help desk (dell, leapfrog and even verizon and everyone is stumped). I read that some people were able to fix this by uninstalling their Service pack three and reinstalling it but I cannot seem to uninstall it. I am at a loss, this should not be this difficult. Initially after the rebuild the laptop was able to work fine with the internet until I brought it to work (works fine here at the office) and then I took it home again and it was doing the same thing.
A: Sorry Lesley, this chat is for Windows Embedded Compact (WinCE), and not the desktop. Hopefully you'll be able to find an answer elsewhere. I'd also try searching for your particular problem on bing.com, specifying your particular laptop, as I would guess other similar laptop users have encountered the same issue. I'd also make sure you have the latest drivers from your manufacturer.
kurtken_msft (Expert):
Q: no, I´m having issues with my own NOR.
A: Is there a single partition on the device, or are there multiple partitions? Is the partition being deleted the first one on the NOR, or does it come after the first partition?