Trolltech Home | Qt-solutions Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-solutions Archive, January 2008
RE: Issue creating files using QFile::open from a QtService based app


Message 1 in thread

With QT 4.3.3, and the latest QTService code on a Windows XP SP2 box,

 

I am consistently getting a access denied from a QFile.open call that I
make that works fine in either -exec more, or when I run the same app as
a non-service...

 

Permissions are wide open on the directory, so I'm wondering if it's a
Windows "protection".. Any ideas on how to get around it?

Scott


Message 2 in thread

Scott Aron Bloom wrote:
> With QT 4.3.3, and the latest QTService code on a Windows XP SP2 box, 
> 
> I am consistently getting a access denied from a QFile.open call that I
> make that works fine in either âexec more, or when I run the same app as
> a non-serviceâ
> 
> Permissions are wide open on the directory, so I'm wondering if itâs a
> Windows âprotectionâ.. Any ideas on how to get around it?

It is a Windows permission "issue". Windows services, by default, are
run as SYSTEM user. You can view your current processes and the user
under which it is running from Task Manager. I'm guessing you are trying
to open some file for writing?

Generally if you need the service to write somewhere, you'd run it under
a non-SYSTEM user that is specific to the service. An example of that
would by the PostgreSQL server for Windows.

If you run the service app with -exec, it gets executed just like a
regular application so it gets run under your current user.

- Adam

--
 [ signature omitted ] 

Message 3 in thread

Thanks.. I did finally track it down, and you are correct... However,
the solution was to write my files (which were temporary in nature
anyway) to a temp direcotyr.

Scott

> -----Original Message-----
> From: Adam M [mailto:adamm@xxxxxxxxxxx]
> Sent: Sunday, January 06, 2008 4:14 PM
> To: qt-solutions@xxxxxxxxxxxxx
> Subject: Re: Issue creating files using QFile::open from a QtService
based
> app
> 
> Scott Aron Bloom wrote:
> > With QT 4.3.3, and the latest QTService code on a Windows XP SP2
box,
> >
> > I am consistently getting a access denied from a QFile.open call
that I
> > make that works fine in either -exec more, or when I run the same
app as
> > a non-service...
> >
> > Permissions are wide open on the directory, so I'm wondering if it's
a
> > Windows "protection".. Any ideas on how to get around it?
> 
> It is a Windows permission "issue". Windows services, by default, are
> run as SYSTEM user. You can view your current processes and the user
> under which it is running from Task Manager. I'm guessing you are
trying
> to open some file for writing?
> 
> Generally if you need the service to write somewhere, you'd run it
under
> a non-SYSTEM user that is specific to the service. An example of that
> would by the PostgreSQL server for Windows.
> 
> If you run the service app with -exec, it gets executed just like a
> regular application so it gets run under your current user.
> 
> - Adam
> 
> --
> To unsubscribe - send "unsubscribe" in the subject to qt-solutions-
> request@xxxxxxxxxxxxx

--
 [ signature omitted ]