Wiki source for ioCanRenameImage


Show raw source

======**Image write security**======

Optional

sqInt ioCanRenameImage(void); via secCanRenameImage
sqInt ioCanWriteImage(void); via secCanWriteImage
sqInt ioDisableImageWrite(void); via primitiveDisableImageWrite

**Parms**: NONE
**return**: NONE, fake return of zero
**From**: Interpreter
**Why**:
Enables the ability to make the image non-writeable. This is part of the security model embedded in the squeak file pluginn

**Responsibility**:
Normally you can write the existing image to the filesystem, either replacing the existing image, or saving to another location, assuming
the file system lets you write anywhere.

These calls let you turn off the feature of rename/write. Their implementation on all platforms is below. Once you call ioDisableImageWrite then
there is no way to allow writing again. This also disables the ability to get the imageName

static int allowImageWrite = 1; /* allow writing the image */
int ioCanRenameImage(void) {
return allowImageWrite; /* only when we're allowed to save the image */
}

int ioCanWriteImage(void) {
return allowImageWrite;
}

int ioDisableImageWrite(void) {
allowImageWrite = 0;
}


**BUGS**

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki