|
I was having the same issue. When the ini file was created by someone in the administrators group, the file was only accessible by others in the administrators group. 'Normal' users were denied permission.
So I changed the fourth parameter in the CreateFile() function call to be:
m_hFile = CreateFile(..., ..., ..., GetSAForEveryone(), ..., 0, 0);
SECURITY_ATTRIBUTES* GetSAForEveryone()
{
static SECURITY_ATTRIBUTES SA;
static SECURITY_DESCRIPTOR SD;
static bool FirstTime(true);
if (FirstTime)
{
SD.Revision = SECURITY_DESCRIPTOR_REVISION;
SD.Sbz1 = 0; // reserved
SD.Control = SE_DACL_PRESENT;
SD.Owner = 0;
SD.Group = 0;
SD.Sacl = 0;
SD.Dacl = 0; // This grants access to everyone
SA.nLength = sizeof(SECURITY_ATTRIBUTES);
SA.bInheritHandle = false;
SA.lpSecurityDescriptor = &SD;
FirstTime = false;
}
return &SA;
}
This works great. The file is created so that everyone on the machine can read/write/delete/copy/move it.
However, the next hurdle you will face is that if a user in the administrators group copies/moves the file to another folder, the file is again not accessible by all users. To get around this issue I found a page (http://support.microsoft.com/kb/310316) that addresses the issue. The bottom line is that I set the registry entry mentioned in that article for each user that creates the file. This may not be an acceptable solution in your case but it works for me.
|
|
|
|
|
skornel . .. MY actual requirement is - i have a file, that is having "R" only permision for users... its some thing like a log file. THe program has to be RUN in USER MODE(Restricted permission). But in betweeen i have to switch to admin mode to make some chnges in that file.
Iam trying to use cacl - a windows command to change file permission
Proud To Be an Indian
|
|
|
|
|
graduation need me programme a project:email processng system ,who could help me ?could you give me some suggestions,please?Language:VC++
|
|
|
|
|
I'm working with DirectShow
and I use
CString strFileName = "c://videos//sample.mpg");
wstrMediaFile = strFileName.AllocSysString();
IGraphBuilder->RenderFile(wstrMediaFile, NULL);
I have copy this file to memory using the following code
BYTE *pBuffer = (BYTE*)malloc(20480000);
CFile file;
int result = file.Open("c:\\videos\\sample.mpg", CFile::modeRead);
unsigned long Filesize = file.GetLength();
file.Read(pBuffer, Filesize);
Question: How can I give a sytem file name to the buffer so I can use it
with the RenderFile function?
Thank You
Hector Maturana
|
|
|
|
|
What are you trying to do?
What does a file name have to do with a video buffer?
RenderFile takes the pathname of the file as a parameter. You can't load the file into memory
and use it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Well, I have to play two file in secuence and I have not find the way to do do it properly.
My first attempt was to create to Graph. while the first rendering is been Run I Pause the second one. As soon as i received the EC_COMPLETE I stop the first file and run the second one. But this solution did not give me a smooth transition. Becouse there is two windows. So I'm planing to create a video fuffer where I merge both files. The first one is local in the HD and the second one is a URL address. I was recomended to use VRM-9 but I just start to study the mixer filter.
Well the idea naming the buffer was something like a ram disk file. So that why I am trying to use CMemFile but CMemFile can not get a system file name.
Well if I sound kind of lost I think I am
|
|
|
|
|
You probaly need to build your own filter graph instead of using RenderFile so you can control the
VMR. Even if you do this though, you'll have to deal with when to play the two streams. The
streams are buffered (5 seconds by default) before they start playing so you'd need to
preroll somehow to get a smooth transition.
A much easier alternative may be to use DirectShow Editing Services to build a timeline based
on the two streams. Then the render engine is used to preview (play) the combined streams.
The render engine in DES handles all the messy work of building a filter graph, connecting
the VMR, and rendering/playing the sreams at the right time. It also provides effects and
transitions you could use between the two videos to make it fancy (some of these don't work
great in preview mode though unfortunately .
Check it out....it may be what you're looking for and save you alot of work. It's in the
DirectShow SDK, which is part of the Platform SDK: DirectShow Editing Services[^]
-- modified at 13:17 Tuesday 1st May, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I just finished running the TimeLine sample and it seams that the
featues are there. So I'll dig in the documentation to learn more about DirectShow Editing Service.
Thank You.
|
|
|
|
|
I'll write this in a general form b/c I don't think code is really necessary. So I have two seperate classes A and B. I'm trying to create an object of type A by providing object B to a type A constructor. (Essentially converting it.) I'm also trying to do this the other way around. (Essentially being able to convert it back using a construcotr.) The problem I'm running into is that each class's constructor seems to need the other class to be completely defined first.
Does this approach even make sense? I understand the problem, but I don't have the experience to get around the problem.
Any suggestions?
Thanks,
Harold
|
|
|
|
|
This problem in common enough. Use a forward reference like this:
class B;
class A
{
public:
A(const B &other);
};
class B
{
public:
B(const A &other);
};
A::A(const B &other)
{
}
B::B(const A &other)
{
}
Steve
|
|
|
|
|
I think I tried this before, but where I went wrong was trying to access members of the class before it was defined. Using your code as an example, in the constructor declaration you have in A I used something like B.variable1 and B.variable2. (Actually I was using a pointer instead of &other but I don't think that matters.) So correct me if I'm wrong, but it seems that you are declaring your constructors w/in the class defintions but defining them outside where it is possible to use the class members?
Thanks for your help on this.
-Harold
|
|
|
|
|
|
Some time it will error, cannot not display page, how to fix?
Thanks.
|
|
|
|
|
Try reinstalling full MSDN again.
Regards,
Paresh.
|
|
|
|
|
I have build SDI using MFC. I would like to have a static text display area on main CMyFrame::CFrameWnd class so I can output text message to this area. How can I do it? Thanks.
|
|
|
|
|
Why CMainFrame? Where to put the static ctrl? Note that main frame consists of the a title bar, menu bar, tool bar and status bar. And the remaining part is the view (CView derived). So, where to put the control?
--
=====
Arman
|
|
|
|
|
I mean I have SDI frame window and I would like to put up a static area on the this frame I guess I don't need the control for the static text area where i only use to put my text strings for user to see. How can I do it in MFC? or better how can i use CSplitter class to split this SDI frame to multiple area?
|
|
|
|
|
I'm trying to play wav files. I've successfully played the registered windows sounds (SystemAsterisk, SystemExit, etc.) using PlaySound() with the SND_ALIAS flag. However, I want to access the Explorer sounds (particularly the Start Navigating "Click" sound). Does anyone know how this is supposed to be done?
|
|
|
|
|
I think you need to read the registry to get the actual filename associated with the event, then pass the filename to PlaySound. For Start Navigating it's HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\Navigating\.current.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks.
I've tried this, but I can't seem to read the key properly. I can't seem to read the (Default) value properly. I can read any other key, it seems, but not this one. Currently, I pass NULL and "(Default)" as the values into RegQueryValueEx(), but both return ERROR_INVALID_PARAMETER. I tried opening the "AppEvents\\Schemes\\Apps\\Explorer\\Navigating" key, and then querying the ".Current" value and that didn't work either. I've looked all over trying to figure out what I'm doing wrong. Can you please advise? Thanks.
|
|
|
|
|
Try passing the empty string "" as the name of the value. That's what I've always used.
Judy
|
|
|
|
|
Thanks. It turns out my problem was something else - I wasn't passing in the pointer-to-size required as part of the last parameter. I thought I could ignore it since I didn't need it. However, the API requires it unless the data variable is also NULL. It still made me look for my problem elsewhere. Thanks for you help.
|
|
|
|
|
Hello,
My question is about resizing a child window of a multi document /view application.
If the view displays a big Bitmap and I try to resize it by dragging it with the mouse, the latter is very slow and shows border effects.
So my idea is for example to mouse click on one of the side of the window and while I move the mouse, the window does not resize.
Actually it will resize just after I release the mouse button. The new position will be where I released the mouse. Please note that it is just an idea and any suggestion is very welcome.
I tried to find some articles before posting my question here but I was not successful.
Please could you recommend me a solution or articles explaining how to solve this problem?
I have no specific code to show. I just visited the functions OnCreate, OnInitialUpdate,Onsize, OnDraw and OnEraseBkgnd (this last fct is to avoid flickering).
Many thanks for your answers.
|
|
|
|
|
I'd say you need to implement some kind of clipping so you're not drawing the whole bitmap each time, just the portion which is visible. How are you displaying your bitmap? BitBlt?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Can someone tell me what function can I use to read an Xml file, from an window form?
Thanks!
|
|
|
|