winapi - logonUser not supported - java

i desperate.
my applications run as windows service, and it needs to create new regular process with different credentials.
it should run under win nt, xp, 7, etc.
because it runs as a service, i have to use the logonUser and CreateProcessAsUser win api functions (and not CreateProcessWithLogon).
on win 7 + win 2003 server it works perfect, but on win xp i got error code 50 while invoking "logonUser" ("the request is not supported").
i tried to play around with the local security policy, but it didn't work.
any suggestions?
(i invoke logonUser with default provider flag (0) and logon interactively (2)).
EDIT:
the problem is probably not windows xp. i run the same code on other win xp machine, and it worked. so, it is problably specific configuration on specific machine.
maybe the i changed some configurations while i was playing with previous problems (http://stackoverflow.com/questions/6898361/createprocessasuser-win-api-is-not-working-on-non-win7-platforms)
therefore, maybe my question should be: what configuration can effect the logonUser function, so the error message "The request is not supported" can be raised?
p.s.
i cant be sure that logonUser was successfully completed before, but i think it does.

Related

Printing form a script/application which is running as Windows service

I have a bit of a (at least for me) odd problem. I have created a (Java) Application which (when some conditions are meet) runs a PowerShell script that uses MS-Word to print some document. I run this application through a simple batch file (java call).
It works like a charm when I run the application through my batch, BUT when I (using NSSM or AlwaysUp) turn it into a windows service the and trigger the printing process it fails. I see in the task manager that a MS-Word process is started, and it take away lots of CPU, but it does nothing (no matter how long I wait).
Simplified code:
$objOffice = New-Object -comobject Excel.Application
$objDoc = $objOffice.Workbooks.Open("C:\printTest\printFile.xlsx")
$objDoc.printout()
$objDoc.Close($false)
$objOffice.quit()
I have tested this on other computers as well... Same result.
Also interesting:
EDIT: This part written where was my fault, and fixed it.
At this point I am not even sure that it has something to do with the powershell command, but I am getting out of ideas.
Start-Process -FilePath 'C:\printTest\printFile.xlsx' -Verb print
Also, take a look at this page, which says
You might notice the option for “Allow service to interact with desktop”, which we mentioned earlier – by default, services are not
allowed to access your desktop unless this box is checked, and this
checkbox is really only there for legacy support.
But just checking
that box doesn’t immediately give them access – you would also need to
make sure that the NoInteractiveServices value in the registry is set
to 0, because when it is set to 1, that checkbox is ignored and
services can’t interact with the desktop at all. Note: in Windows 8,
the value is set to 1, and interactive services are prohibited.

Java ME SDK 3.2 (and 3.3, 3.0 as well) just won't start

When i try to launch it any way, Java ME just freezes. To be more specific, javaw.exe called by device-manager.exe seems to go into infinite loop, since not a single exception or error message is passed. Icon in tray appears, but its menu, instead of devices list, shows only one entry: Exit, which incidentally doesn't work. I can only shutdown it through task manager. And since device-manager is required for emulator, i can't work with it at all.
I tried versions 3.0,3.2,3.3 of Java ME SDK and this problem persists in each one. OS: Windows 7. JDK: 7u25.
I've tried each and every advice i found on the Internet and still can't get it working. Device-manager log shows that the problem starts upon calling "rmiRegistryPortFile".
[2013-07-02 19:20:53.070] DEBUG - strap.BasicObjectConfiguration - Calling create on rmiRegistryPortFile
That's always the last entry in the log.
There was only one way i've managed to get it working - by installing and running it under Windows Virtual PC. Curious thing is, under VM it's working fine in the same very OS (freshly installed Windows 7). But unfortunately that didn't really give much on the cause of the bug, and that's not a solution :( I have to somehow get it working without VM.
I tried reinstalling Windows, that didn't help. Looked through javaw I/O in Process Monitor and compared it with working one. It looks like one of the application threads suddenly shuts down after reading file "rt.jar" (when loading "rmiRegistryPortFile" i guess?), whereas working javaw writes to log-file immediately after that. Windows logs got nothing on the subject: no permission issues, no errors or warnings at the time.
Tried modifying PATH variable to the dir with rmiregistry.exe, did not help. Network sockets are available. Changed DEP settings, same.
Could anyone please help? I've spent days on this bug already.
It's definitely a permission problem. Try to look if any folder related to Java is "READ ONLY".
If you get this error message when trying to run midlets through the built-in emulator of the JavaME SDK 3.0, try disabling DEP for runMidlet.exe.
Data Execution Prevention (DEP) configuration can be found at the following place in Windows: Control Panel > System Security > System > Advanced system Settings > Advanced tab > Performance > Data Execution Prevention.
Add this file to the DEP exclusion list:
<javame-install-dir>\runtimes\cldc-hi-javafx\bin\runMidlet.exe
If things work for you now, complain loudly to Sun (now Oracle) that they need to make software without buffer overflows.
Personally I filed a bug-report against the JavaME SDK 3.0. You should do that too, or make your voice heard on the same bug-report that you're having this problem as well.
Freshly installed windows doesn't have msvcrtXX.dlls
Go to folder runtimes\\cdc-hi\\bin and copy Microsoft.VC80.CRT into runtimes\\cldc-hi-javafx\\bin. This problem will be fixed over autoupdate soon.
Problem with localhost
Please edit <javamesdk_installdir>\\toolkit-lib\\modules\\bootstrap\\conf\\system.properties and change
device-manager.object-registry.host=localhost to: device-manager.object-registry.host=127.0.0.1
Port 1299 might be taken
Please edit <javamesdk_installdir>\\toolkit-lib\\modules\\bootstrap\\conf\\system.properties and change
device-manager.object-registry.port=1299 to: device-manager.object-registry.port=1999
XP 64-bit
Please use 32-bit version of JDK.
Firewall
Make sure that firewall is not blocking communication on ports given in 3. Default port numbers are 1299 for windows and 1999 for Mac.
I have tried all those steps above to no avail, until I replaced my JDK jdk-8u117 with jdk-8u112 (Must be 32 bit) after reading this thread https://community.oracle.com/thread/4009110. I had to restart my machine after changing the Java version because it was not detecting right away after installation. I'm using Netbeans 7.4.

Windows 7 - JAVA - starting or stopping apache 2 (httpd) service

I would like to know how to stop, start, and restarting the Apache (2.0.64) service installed under Windows 7 in my program JAVA (executed in the same machine).
Initially, I developed my apps in Linux environment and I had no problem to do that. Now, I'm migrating in Windows 7, and I can't do it. I have an error message like : "(OS 5)Access denied. : failed to open Apache2 service".
At the beginning, I thought that error is due to the fact that my account system doesn't have enough rights to do so. I tried to change proprietary of folder c:\Program Files(x86)\Apache2, and in Services (open session as my account). It still no working and I get the same message every time.
I need absolutely to control Apache2 process.
If anyone have any ideas that could help me?
Thank you.
One more strange stuff of Windows ....
I figured out why my apps in JAVA didn't work in Windows 7 environment. It juste because since Windows Vista, MS tries to hide the "popup flooding" stuff with something called "UAC - User Account Control".
And in the default configuration, whatever you do; change proprietary of files or services, you still execute them in "limited user" so you don't have trace, you don't know why your programs don't work properly, and you can't even debug it ...
So, if you want to execute an exec stuff in Windows that was installed as "Administrator" role from you apps (Java in my case) , you must play with levels that provide UAC and restart your computer to take effect of that modification.
For me, i set i to the lowess level and it work. I remarked that when i do "Windows"+R, i have a message like "This task's going to be executed as admnistrator privileges"... OK
In short, when you develop with Windows you must debug Windows first, then your apps
....
Welcome to Windows and long life Linux !

Inconsistent GWT behavior in IE 8

All,
I have a web site that's built with GWT at https://penwag.com/penwag/. If you just hit the site and see the main page, there's supposed to be a login/registration area that displays, along with a teaser for the site. I've tried the site with most of the main browsers - FF 3 & 3.5, IE 6 & 8, Safari, and Chrome, and all appears well to me.
However, I have a non-geek user that has visited the site from both work and home. The work computer can see the intro page fine, but the home computer shows only the static content, and non of the javascript-based portion, that is the login/registration and teaser. Both computers are using IE 8. He checked the computer where the site fails, and scripting is enabled.
Can anyone else see the problem? (You don't have to register to see the problem, just hit the main page.) Anything else I should check or have him try?
Thanks!
Edit:
The site is implemented using GWT 1.7.0.
I'll have to find out about the OS versions.
Edit:
The one that works is running Windows XT, the failing one is running Windows Vista. (There's a shocker!) I myself have viewed it successfully with both OSs.
Edit:
I've since completely re-structured the site, and documented the changes here:
http://penwag.blogspot.com/2010/04/april-penwag-update.html
So, the site is no longer the same as when I asked this question.
There are a lot of possibilites what can cause such a problem.
At first force your user to refresh cache in IE:) There are a lot of cases when you have updated your application, but users are still using the old version because of cache.
If doesn't help, you have to make sure that user doesn't see any errors. Those can be cause by a lot of things, such as different locale, default language and etc. By default, when an error happens in IE, a warning sign is displayed in left bottom corner. Ask your user for a screenshot, to check if such error is present, and then ask him to send you this error. This might help.
At last ask the user to launch IE in no-extensions mode. If your site works fine in this mode, it means that some extension have broken the functionality of your site.
I am running IE 8 on Windows XP SP3 and I do receive an error when trying to access your page linked above.
To try and pinpoint where in your code the problem is happening, you could try compiling your GWT application using the PRETTY or DETAILED style flag.
code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.html#Why_is_my_GWT-generated_JavaScript_gibberish?
Error:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)
Timestamp: Thu, 12 Nov 2009 02:13:32 UTC
Message: Exception thrown and not caught
Line: 1430
Char: 182
Code: 0
URI: https: //penwag.com/home/06C3015B261A5DD1F637E9F95A5AF26C.cache.html
I am also experiencing a similar problem when trying to load a GWT application that I've been working on (works fine on Firefox and works fine on other installations of IE 8). The error with my GWT app loading in IE 8 seems to happen when it tries to make its first RPC call to the server. Uninstalling and reinstalling IE 8 (and Service Pack 3) have not been successful in resolving this.
Update:
After debugging the javascript running in my instance of IE 8, i was able to track down a solution to this problem. GWT 1.7.0 has a known issue (issue 3927, issue 4163) where GWT RPC calls will fail in IE 8 if the native XMLHTTP support is disabled. This setting can be found at the following location:
Tools->Internet Options->Advanced->Security->Enable native XMLHTTP support
Try using latest GWT build 1.7.0, according to relase notes:
Updated GWT libraries to support IE8
I tried with IE 8 (version 8.0.7100.0, running on Windows 7 RC) and page renders fine.

SWT Browser Problem on Vista

We're running Java Swing and are using an SWT bridge to get ahold of the SWT browser. Everything normally works just fine, but we have a problem on a Vista test machine. It worked fine until just a week ago or so. The call stack:
org.eclipse.swt.SWTError: No more handles
at org.eclipse.swt.SWT.error(SWT.java:3589)
at org.eclipse.swt.SWT.error(SWT.java:3481)
at org.eclipse.swt.SWT.error(SWT.java:3452)
at org.eclipse.swt.browser.IE.create(IE.java:184)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:109)
...
I have tried IE7 and IE8 through the SWT browser, but none is working (XULRunner is not applicable on our application since we need two browser instances).
XP, Windows7 and Vista is working on other machines, and I can't exclude something being correpted on this specific machine. We got some Windows updates close to when this error started happening, they seem related. It is a our only Vista test machine with a virtual screen, has there been any Windows updates for IE relating to virtual screens that could cause this? To me it looks like a likely target for security holes, so maybe that could be it?
I know this is looking for a needle in a haystack, but has anybody seen anything similar lately?
Edit: looking at the source, I see that the IE.create method swallows an exception to throw this error - I'd step into the WebSite constructor to try and figure out what's happening.
My solution is not to embed the SWTBrowser into our Swing application at all. (I've always hated web tech on desktop apps anyway. :)

Categories

Resources