首页 \ 问答 \ 为什么LoadLibrary不能使用给定的路径?(Why LoadLibrary not working with the given path?)

为什么LoadLibrary不能使用给定的路径?(Why LoadLibrary not working with the given path?)

我正在尝试调用LoadLibrary方法,但它返回0. Marshal.GetLastWin32Error返回126(找不到指定的模块。)。

码:

[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);

string path = @"C:\junk\测试\BlueStacksKK_DeployTool_2.5.48.7209_china_gmgr\ProgramFiles\BstkC.dll";
IntPtr ptr = LoadLibrary(path);
int error = Marshal.GetLastWin32Error();

但是,如果我将此文件移动到其他位置,如C:\Test\BstkC.dll ,它可以正常工作。

问题可能是由于路径上的测试 。 因此,如果我们使用除英语之外的其他语言,那么它将如何运作。

仅供参考。 File.Exists(path)返回true。


I'm trying to call LoadLibrary method, But it returns 0. Marshal.GetLastWin32Error is returning 126 (The specified module could not be found.).

Code:

[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)]
static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);

string path = @"C:\junk\测试\BlueStacksKK_DeployTool_2.5.48.7209_china_gmgr\ProgramFiles\BstkC.dll";
IntPtr ptr = LoadLibrary(path);
int error = Marshal.GetLastWin32Error();

But If I move this file to some other location like C:\Test\BstkC.dll, it works fine.

Issue could be due to 测试 in path. So If we have direcotry in other languages other then English, how will it work.

Just for your information. File.Exists(path) returns true.


原文:https://stackoverflow.com/questions/40907264
更新时间:2023-11-09 10:11

最满意答案

Spring Roo在其_entity.aj方面对其自己的ID字段进行了gerate。 因此,“base”类中不需要使用@ID标记的额外字段。 Roo的管理ID字段应该由Roo的DataOnDemand填充。

默认情况下,roo托管ID的数据库列为“id”。 如果您需要其他列名称(例如,以匹配数据库模式),则可以通过@RooEntity.identifierColumn指定该列。


Spring Roo gerates it own ID field, in its _entity.aj aspect. So no extra field marked with @ID is needed in the "base"-class. The Roo managed ID field should be populated by Roo's DataOnDemand.

The data base column for the roo managed id is "id" by default. If you need an other colum name (for example to match the database schema) then the column could be specified by the @RooEntity.identifierColumn.

相关问答

更多
  • 请注意,Spring Roo和JBoss Seam不能直接比较,因为JBoss Seam本身不提供问题中提到的CRUD应用程序生成。 但是JBoss Seam随附了seam-gen工具,它提供了这个功能。 因此,将JBoss Seam与Spring框架进行比较可能会更好,并将seam-gen工具与Spring Roo进行比较。 我知道这也不是一个完整的比较,但是我猜这不在这个topice之内。 需要说明的是,在下面的答案中,当我提到JBoss Seam时,其实我指的是JBoss Seam与seam-gen工 ...
  • 为了一致性,我会编写setKey()方法。 但是你不会因为不这样做而造成任何问题。 I would write the setKey() method just for consistency. But you are not causing any problems by not doing this.
  • 你在Eclipse中安装了STS和WTP吗? 您是否在Roo控制台中尝试了以下操作: perform eclipse ? Have you STS and WTP installed in your Eclipse? Did you tried the following in the Roo console: perform eclipse ?
  • 您似乎没有将EntityManager和相关的应用程序上下文注入到测试中。 请尝试在类声明上方添加以下行。 @ContextConfiguration(locations = { "/META-INF/spring/applicationContext.xml","/META-INF/spring/applicationContext-security.xml" }) 并尝试使您的测试类从AbstractJUnit4SpringContextTests进入inhert。 请记住,您可能必须为要执行的某些操 ...
  • 我猜你试图删除一条从其他表中引用记录的记录。 删除PizzaOrder时它应该可以正常工作。 但是如果您尝试删除Pizza,那么在PizzaOrder中存在一些数据,您无法执行此操作,因为它未配置为在删除时级联。 I guess you were trying to delete a record that was referring a record from other table. When you delete a PizzaOrder it should work fine. But with s ...
  • Spring Roo在其_entity.aj方面对其自己的ID字段进行了gerate。 因此,“base”类中不需要使用@ID标记的额外字段。 Roo的管理ID字段应该由Roo的DataOnDemand填充。 默认情况下,roo托管ID的数据库列为“id”。 如果您需要其他列名称(例如,以匹配数据库模式),则可以通过@RooEntity.identifierColumn指定该列。 Spring Roo gerates it own ID field, in its _entity.aj aspect. So ...
  • 您可以在Roo会话期间偶然切换到Entitet 。 明确目标类: field reference --fieldName Entitet --type ~.domain.Entitet --class ~.domain.Opcina 或者首先切换焦点: focus --class ~.domain.Opcina field reference --fieldName Entitet --type ~.domain.Entitet You could have switched over to Entit ...
  • 您可以使用Springsource Tool Suite(STS)上提供的Roo命令向导。 You can use the Roo Command Wizard available on the Springsource Tool Suite (STS).
  • 您似乎已尝试将GWT和Spring MVC控制器用于Web应用程序。 只使用一个,它会工作。 与Roo一起欢呼和最好的。 :) It appears that you have tried to use both GWT and Spring MVC Controllers for your web application. Use only one, and it would work. Cheers and all the best with Roo. :)
  • 因此,在我花时间分析问题之后,似乎不是Roo本身从classpath中删除了aspectj jars而是在versin 2.7中删除了eclipse-Plugin(这是由command> roo项目引起的)。 我不知道这是一个错误还是一个功能,但创建一个带有该插件的eclipse项目删除了这个jar。 切换到2.8解决了问题。 所以作为回答: - >使用进一步的运行时编织 - >魔术发生在eclipse-plugin中 So, after I took the time to analyze the pro ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)