本文介绍了CreateFile2函数限制在removableStorage中创建SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在可移动存储中创建一个SQLite数据库,我按照功能和文件类型关联的步骤进行操作,因此在处理完文件之后,我决定在可移动存储中使用SQLite数据库。

I was trying to create a SQLite database in the removable storage and I follow the steps using capabilities and file type association, so after working with files I decided to use a SQLite database in the removable storage.

我的惊喜是它返回了一个CannotOpen,所以我在SQLite电子邮件论坛中注册,我收到了Howard Kapustein的一个非常有趣的答案。

My surprise is that it returns a CannotOpen so I sign up in the SQLite email forum and I have received a really interesting answer from Howard Kapustein.

他告诉我SQLite使用  CreateFile2函数。这是一个非常有限的功能。

He told me that SQLite uses https://msdn.microsoft.com/en-us/library/windows/desktop/hh449422(v=vs.85).aspx CreateFile2 function. And it is a really limited function.

这意味着这是一个重要的限制,使远程设备将传感器信息存储为数据记录器。因此在物联网领域应该解决。有没有办法让MS改进该方法和API以超越这个限制?

It means that is a significant limitation making remote devices that store sensor information as data loggers. So in the world of IoT that should be solved. Is there any way that MS improves that method and API to overpass this limitation?

Juan Pablo GC

Juan Pablo G.C.

推荐答案

CreateFile2具有运行时检查限制UWP应用程序可以访问的文件夹 - 这不是API本身是有限的,而是故意运行时检查以强制应用程序/数据的沙箱。如果开发人员从控制台
(o / s级别)应用程序使用CreateFile2,他们会发现他们可以在任何文件夹/分区中创建文件。

CreateFile2 has runtime checks to limit the folders that a UWP application has access to – It’s not that the API itself is limited, but a deliberate runtime check to enforce sandboxing of applications/data. If a developer were to use CreateFile2 from a console (o/s level) application they would find that they can create a file in any folder/partition.

所以如果你是用C ++构建一个SQLite版本,那么它应该没有任何问题,然后你的UAP应用程序可以与该服务进行通信。

So if you were to build a version of SQLite in C++, then it shouldn’t have any problem and your UAP app could then talk to that service.


这篇关于CreateFile2函数限制在removableStorage中创建SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 02:04