Windows CE在重置时删除.NET CF [英] Windows CE deletes .NET CF on reset

查看:112
本文介绍了Windows CE在重置时删除.NET CF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为专有Windows CE 4.2设备编写C#应用程序(关于该设备,我没有规格或几乎没有任何其他信息。我可以访问文件系统,基本上就是这样。) )
我也无法从原始制造商那里获得支持。

I'm writing a C# application for a proprietary Windows CE 4.2 device (for which I don't have the specs or pretty much any other information. I've got access to the file system, and that is basically it.) I also can't get support from the original manufacturer.

现在,我可以很好地安装.NET Compact框架了,并且一切正常工作了一段时间。但是每隔一段时间,当设备重置时,它会删除框架,GAC及其相关的所有内容。

Now, I can install the .NET Compact framework just fine, and everything works for a while. But every once in a while, when the device is reset, it deletes the framework, the GAC, everything related to it.

我知道这不仅是硬重置跳回出厂默认设置,因为:

I know it's not just a hard reset jumping back to factory defaults because:


  1. 它会记住注册表设置(如果我再次尝试安装,它说框架已经安装,并询问如果我想重新安装,显然注册表项仍然存在。)

  2. 即使我将框架安装到可移动闪存卡上,文件也将被删除。 (但是,存储卡上的其他文件都被保留了。)

我知道没有太多事情要做,但是也许某些Windows CE专家会能够告诉我为什么会这样,以及是否有一些合理的方法可以避免这种情况。我对Windows CE不太了解,所以就我所知,这可能完全是标准行为。

I know there isn't much to go on, but perhaps some Windows CE guru will be able to tell me why this happens, and if there's some sane way to avoid it. I don't know much about Windows CE, so for all I know, it might be perfectly standard behavior.

就此而言,关于如何自己进一步解决此问题的任何建议吗?目前,我能看到的最好的解决方案是在每次启动时都重新安装所有内容,但这似乎有点笨拙。

For that matter, any advice on how to troubleshoot this further myself? At the moment, the best solution I can see is to simply reinstall everything at every boot, but that seems a bit clumsy.

编辑:
重置后,在文件系统根目录中找到的GACLOG.TXT包含

After a reset, GACLOG.TXT found in the root of the filesystem contains


CGACUTIL:初始化12/08/2008

CGACUTIL: Initializing 12/08/2008

20:43:57.000 CGACUTIL:已初始化

20:43:57.000 CGACUTIL: Initialized

2008年12月8日20:43:57.000 CGACUTIL:

12/08/2008 20:43:57.000 CGACUTIL:

正在删除Microsoft。 NET CF 3.5.GAC

2008/12/08 20:43:57.000 CGACUTIL:完成

12/08/2008 20:43:57.000 CGACUTIL: Done

2008/12/08 20 :43:57.000 CGACUTIL:

12/08/2008 20:43:57.000 CGACUTIL:

退出12/08/2008 20:43:57.000

Exiting 12/08/2008 20:43:57.000

所以,肯定是要删除GAC。为什么,为什么要停止它呢?

So yeah, it's definitely deleting the GAC. Why though, and how to stop it?

推荐答案

您在这里看到的一些Windows CE和CF行为是给你这种行为。不幸的是,没有真正好的解决方案,但是我至少可以为您提供一些指导。

There are a few Windows CE and CF behaviors that you're seeing here that's giving you this behavior. Unfortuantely there's no really good solution, but I can at least give you some guidance.


  1. Windows CE将当前的对象存储(包括文件)存储在Windows CE中。文件系统不是专门位于RAM中的持久性存储上。这包括添加到Windows文件夹中的所有文件和/或文件夹(在您的情况下,这是关键)。当设备断电时-通常在软复位或硬复位中,这些数据都会丢失。

  2. CE注册表可以(可能在您的设备上)存储在持久性存储中。这可能在文件系统中(作为配置单元)或在某些不可见的位置(OEM可以通过两种不同的方式存储它)。重置后, not 不会丢失。只有保存的而不是未刷新的项目会丢失。

  3. 作为#2的附录-调用RegFlushKey API时会刷新注册表更改。 自动安装CAB会调用此操作(因此安装CF也会这样做)。某些OEM也会选择定期刷新它。

  4. 当CF GAC显示图像中未包含的项目时,会将文件移动到\ Windows文件夹。它们在装卸组件时会放回(我几年前曾向CF团队抱怨无济于事)。

  1. Windows CE stores the current object store, including files in the filesystem not specifically on a persistent store in RAM. This includes any files and/or folders added to the \Windows folder (this is key in your case). When device power is lost - typically in a soft or hard reset, this data is lost.
  2. The CE registry can (and probably is on your device) be stored on a persistent store. This might be in the file system (as a hive) or in some non-visible location (there are two distinct ways an OEM can store it). This is not lost on reset. Only items saved and not flushed are lost.
  3. As an addendum to #2 - the registry changes are flushed when the RegFlushKey API is called. Installing a CAB automatically calls this (so installing the CF does). Some OEMs also choose to have it flush on a periodic timer.
  4. When the CF GACs an items not in the image, the file is moved to the \Windows folder. They are put back when the assembly is unloaded (I complained to the CF team about this years ago to no avail).

这意味着,如果将CF安装到存储卡上并运行应用程序,则会发生以下情况:

What this means is that if you install the CF to a storage card and run your app this happens:


  1. CF文件在解压缩CAB期间将其复制到持久存储中。

  2. 写入安装注册表项

  3. 注册表已刷新(保存)

  4. 应用程序运行

  5. CF文件已移动(未复制)到易失的Windows中。

  1. CF files are copied to the persistent store during unpacking the CAB
  2. Installation reg keys are written
  3. Registry is flushed (saved)
  4. App runs
  5. CF files are moved (not copied) to \Windows, which is volatile.

现在,如果在加载CF组件时重置设备-of!不再有CF。您的应用程序在存储卡上,但不在GAC中,因此它可以生存,但无法再运行。

Now if you reset the device while the CF assemblies are loaded - poof! no more CF. Your app was on the storage card, but not in the GAC, so it survives but can no longer run.

一种黑客解决方案:使用本机应用程序引导启动您的应用。让它在runWindows上运行时检查CF文件,如果没有,请从持久性存储中的某个位置安装CF CAB(将其标记为只读,以便wceload不会将其删除)。

A hack solution: use a native app to "bootstrap" to launch your app. Have it check for the CF files in \Windows on run and if they aren't there install the CF CAB from a place in persistent storage (mark it as read-only so wceload won't delete it).

另一种选择是将CF程序集与您的应用程序一起分发,而不是GAC分发。

The other option is to distribute the CF assemblies with your app and not GAC them.

这篇关于Windows CE在重置时删除.NET CF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆